initial commit
commit
291249f9b3
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (asana_test)" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/asana_test.iml" filepath="$PROJECT_DIR$/.idea/asana_test.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
import datetime
|
||||||
|
import asana
|
||||||
|
from asana.rest import ApiException
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
|
# Configure OAuth2 access token for authorization:
|
||||||
|
configuration = asana.Configuration()
|
||||||
|
configuration.access_token = '1/1205189706569240:c740a97f0374fcb3d11581c9ccbc92c5'
|
||||||
|
api_client = asana.ApiClient(configuration)
|
||||||
|
|
||||||
|
# create an instance of the API class
|
||||||
|
tasks_api_instance = asana.TasksApi(api_client)
|
||||||
|
workspaces = asana.WorkspacesApi(api_client)
|
||||||
|
task_list = asana.UserTaskListsApi(api_client)
|
||||||
|
tasks_api = asana.TasksApi(api_client)
|
||||||
|
users = asana.UsersApi(api_client)
|
||||||
|
limit = 50
|
||||||
|
timestamp = str(datetime.datetime.utcnow()).replace(' ','T')
|
||||||
|
timestamp = ''.join([timestamp, 'Z'])
|
||||||
|
opt_fields = ["actual_time_minutes","approval_status","assignee","assignee.name","assignee_section","assignee_section.name","assignee_status","completed","completed_at","completed_by","completed_by.name","created_at","created_by","custom_fields","custom_fields.asana_created_field","custom_fields.created_by","custom_fields.created_by.name","custom_fields.currency_code","custom_fields.custom_label","custom_fields.custom_label_position","custom_fields.date_value","custom_fields.date_value.date","custom_fields.date_value.date_time","custom_fields.description","custom_fields.display_value","custom_fields.enabled","custom_fields.enum_options","custom_fields.enum_options.color","custom_fields.enum_options.enabled","custom_fields.enum_options.name","custom_fields.enum_value","custom_fields.enum_value.color","custom_fields.enum_value.enabled","custom_fields.enum_value.name","custom_fields.format","custom_fields.has_notifications_enabled","custom_fields.is_formula_field","custom_fields.is_global_to_workspace","custom_fields.is_value_read_only","custom_fields.multi_enum_values","custom_fields.multi_enum_values.color","custom_fields.multi_enum_values.enabled","custom_fields.multi_enum_values.name","custom_fields.name","custom_fields.number_value","custom_fields.people_value","custom_fields.people_value.name","custom_fields.precision","custom_fields.resource_subtype","custom_fields.text_value","custom_fields.type","dependencies","dependents","due_at","due_on","external","external.data","followers","followers.name","hearted","hearts","hearts.user","hearts.user.name","html_notes","is_rendered_as_separator","liked","likes","likes.user","likes.user.name","memberships","memberships.project","memberships.project.name","memberships.section","memberships.section.name","modified_at","name","notes.txt","num_hearts","num_likes","num_subtasks","offset","parent","parent.created_by","parent.name","parent.resource_subtype","path","permalink_url","projects","projects.name","resource_subtype","start_at","start_on","tags","tags.name","uri","workspace","workspace.name"] # list[str] | This endpoint returns a compact resource, which excludes some properties by default. To include those optional properties, set this query parameter to a comma-separated list of the properties you wish to include. (optional)
|
||||||
|
|
||||||
|
|
||||||
|
def get_tasks():
|
||||||
|
global data
|
||||||
|
try:
|
||||||
|
# GET - get multiple tasks
|
||||||
|
api_response = tasks_api_instance.get_tasks(
|
||||||
|
limit=limit, assignee="1205189706569240"
|
||||||
|
)
|
||||||
|
data = api_response.data
|
||||||
|
# res = users.get_users(workspace='296289166596219')
|
||||||
|
# res = workspaces.get_workspaces()
|
||||||
|
# pprint(res)
|
||||||
|
for d in data:
|
||||||
|
if d.name.find("Mit MG wegen LKW Verkauf reden") > -1:
|
||||||
|
print(d)
|
||||||
|
# pprint(api_response)
|
||||||
|
except ApiException as e:
|
||||||
|
print("Exception when calling TasksApi->get_tasks: %s\n" % e)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def get_user_task_lists():
|
||||||
|
try:
|
||||||
|
# result = task_list.get_user_task_list_for_user(user_gid="1205189706569240")
|
||||||
|
# result = task_list.get_user_task_list_for_user(user_gid="1205189706569240", workspace='296289166596219')
|
||||||
|
# result = task_list.get_user_task_list(user_task_list_gid='1205189707543486')
|
||||||
|
result = tasks_api.get_tasks_for_user_task_list(user_task_list_gid='1205189707543486', opt_fields=opt_fields)
|
||||||
|
# print(result)
|
||||||
|
for d in result.data:
|
||||||
|
if d.name.find("Kos Milorad") > -1:
|
||||||
|
print(d)
|
||||||
|
except ApiException as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
get_user_task_lists()
|
||||||
Binary file not shown.
Loading…
Reference in New Issue