Description
# asana [![GitHub release][release-image]]() [![PyPi Version][pypi-image]][pypi-url] - API version: 1.0 - Package version: 5.2.4 ## Requirements. Python 3.4+ ## Installation & Usage ### pip install from [PyPI](https://pypi.org/project/asana/) ```sh pip install asana ``` Then import the package: ```python import asana ``` ### Setuptools Install via [Setuptools](http://pypi.python.org/pypi/setuptools). ```sh python setup.py install --user ``` (or `sudo python setup.py install` to install the package for all users) Then import the package: ```python import asana ``` ## Getting Started Please follow the [installation procedure](#installation--usage) and then run the following: ```python import asana from asana.rest import ApiException from pprint import pprint configuration = asana.Configuration() configuration.access_token = '<YOUR_ACCESS_TOKEN>' api_client = asana.ApiClient(configuration) # create an instance of the API class users_api_instance = asana.UsersApi(api_client) user_gid = "me" opts = {} try: # Get a user user = users_api_instance.get_user(user_gid, opts) pprint(user) except ApiException as e: print("Exception when calling UsersApi->get_user: %s\n" % e) ``` ### Example: GET, POST, PUT, DELETE on tasks #### GET - get multiple tasks ```python import asana from asana.rest import ApiException from pprint import pprint configuration = asana.Configuration() configuration.access_token = '<YOUR_ACCESS_TOKEN>' api_client = asana.ApiClient(configuration) # create an instance of the API class tasks_api_instance = asana.TasksApi(api_client) opts = { 'limit': 50, 'offset': "eyJ0eXAiOJiKV1iQLCJhbGciOiJIUzI1NiJ9", 'assignee': "14641", 'project': "321654", 'section': "321654", 'workspace': "321654", 'completed_since': '2012-02-22T02:06:58.158Z', 'modified_since': '2012-02-22T02:06:58.158Z', '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,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" } try: # Get multiple tasks tasks = tasks_api_instance.get_tasks(opts) for task in tasks: pprint(task) except ApiException as e: print("Exception when calling TasksApi->get_tasks: %s\n" % e) ``` #### POST - create a task ```python import asana from asana.rest import ApiException from pprint import pprint configuration = asana.Configuration() configuration.access_token = '<YOUR_ACCESS_TOKEN>' api_client = asana.ApiClient(configuration) # create an instance of the API class tasks_api_instance = asana.TasksApi(api_client) body = { "data": { "name": "New Task", "projects": ["<YOUR_PROJECT_GID>"], } } opts = {} try: # Create a task task = tasks_api_instance.create_task(body, opts) pprint(task) except ApiException as e: print("Exception when calling TasksApi->create_task: %s\n" % e) ``` #### PUT - update a task ```python import asana from asana.rest import ApiException from pprint import pprint configuration = asana.Configuration() configuration.access_token = '<YOUR_ACCESS_TOKEN>' api_client = asana.ApiClient(configuration) # create an instance of the API class tasks_api_instance = asana.TasksApi(api_client) body = { "data": { "name": "
Release History
| Version | Changes | Urgency | Date |
|---|---|---|---|
| 5.2.4 | Imported from PyPI (5.2.4) | Low | 4/21/2026 |
| v5.2.4 | - Added time [tracking categories endpoints](https://forum.asana.com/t/new-categories-for-time-tracking-entries/1134291) | Medium | 4/2/2026 |
| v5.2.3 | - New endpoints: portfolio duplication, rates, budgets | Low | 3/18/2026 |
| v5.2.2 | - Added reactions endpoint | Low | 9/24/2025 |
| v5.2.1 | - Added Initiate a resource export endpoint | Low | 8/12/2025 |
| v5.2.0 | Added new export endpoints: https://developers.asana.com/reference/creategraphexport | Low | 6/17/2025 |
| v5.1.0 | - Add auto retry on failed requests: https://github.com/Asana/python-asana/tree/v5.1.0?tab=readme-ov-file#retries | Low | 2/25/2025 |
| v5.0.16 | - Add get events in workspace endpoint - Update opt_fields description | Low | 2/24/2025 |
| v5.0.15 | - Updated GitHub Action publishing workflow | Low | 1/9/2025 |
| v5.0.10 | - [Add archived property to portfolios](https://github.com/Asana/openapi/commit/137698b2897df9b8d0d408e05932a1b50782d15b) | Low | 8/27/2024 |
| v5.0.9 | - [Added `privacy_setting` property to portfolios](https://github.com/Asana/openapi/commit/f2baae7eefae6cbe24b738be7aba9d94e86bf250#diff-de362bb7a24aae39914fbfa6df2a33152388caf41d03de0766a14186a66c083eL11584) - [Update portfolios description](https://github.com/Asana/openapi/commit/ea9f72c2a0b242e599ff187b18fc12f7aaea4fca) - [Added `default_access_level` property to portfolios](https://github.com/Asana/openapi/commit/9a3c0506a9c0cb5a15eefdb52bbda8a2b1c4180f) - [Created `PortfolioMembershipCom | Low | 8/22/2024 |
| v5.0.8 | - [team_content_management_access_level](https://github.com/Asana/openapi/commit/ec5750f9820ab460397ea818c324865bc703bd40) - [is_custom_weight](https://github.com/Asana/openapi/commit/076f9418b0ffdc0a71b055dc06e237e769880099) property on goal metric - [x-hook-secret returned in create a webhook endpoint](https://github.com/Asana/openapi/commit/b8a52d786c03a76d568cdfbd1f4d0dc2e8792403) | Low | 7/27/2024 |
| v5.0.7 | - [New `is_custom_weight` property on goals](https://github.com/Asana/openapi/commit/076f9418b0ffdc0a71b055dc06e237e769880099) | Low | 5/20/2024 |
| v3.2.3 | - Update v3 to v3.2.3 - Add important message to README.md | Low | 4/24/2024 |
| v5.0.6 | - [chore: fixes repsonse type to response #197](https://github.com/Asana/python-asana/pull/197) - [fix: GCP not recognizing access token #196](https://github.com/Asana/python-asana/pull/196) - [Added new allocations endpoints](https://github.com/Asana/openapi/commit/3c5dfe3e9e3f18ad84c0a6abdffb6d8ed1e907ac): create_allocation, delete_allocation, get_allocation, get_allocations, update_allocation - [Added update a membership endpoint](https://github.com/Asana/openapi/commit/ee6907889bd3e3f6a44 | Low | 3/25/2024 |
| v5.0.5 | - [Remove beta warning from README](https://github.com/Asana/python-asana/commit/bab518d482a77434dfcbaa3a9846fb5434d7d34c) - Fixed GitHub Action workflow to publish new versions of python - [Delete task template endpoint added](https://github.com/Asana/openapi/commit/88147389e8fb558ec09dfd90c3b68e5f0f33203b) - Fixed: [urlib3 deprecation warning: HTTPResponse.getheaders() is deprecated and will be removed in urllib3 v2.1.0. Instead access HTTPResponse.headers directly. #192](https://github.com | Low | 3/14/2024 |
| v5.0.3 | - [Add a custom field to a project](https://developers.asana.com/reference/addcustomfieldsettingforproject) endpoint now takes in `opts` argument BEFORE: ``` api_response = projects_api_instance.add_custom_field_setting_for_project(body, project_gid) ``` AFTER: ``` api_response = projects_api_instance.add_custom_field_setting_for_project(body, project_gid, opts) ``` | Low | 12/16/2023 |
| v5.0.2 | - Fix `call_api` not working when no query_params are provided ([Adding a custom field to a project raises exception #188](https://github.com/Asana/python-asana/issues/188)) - Fix [page iterator link](https://github.com/Asana/python-asana/blob/v5.0.0/README.md?plain=1#L534) in README.md going to wrong link | Low | 12/15/2023 |
| v5.0.0 | - Changes from v4: - - Query params are now passed in through `opts` dictionary instead of method params - Added pagination - Updated sample code - Document how to use new client library features - Fix response decode issue of special characters from previous versions | Low | 12/13/2023 |
| v3.2.2 | - Rollback from v4 to v3 -> update README.md to mention v4 = BETA | Low | 10/10/2023 |
| 4.0.11 | - task_templates endpoints - GET /task_templates - GET /task_templates/{task_template_gid} - POST /task_templates/{task_template_gid}/instantiateTask - Added `complete` color option to `current_status.color` value -> for endpoints that return `current_status.color` EX: Projects - Update description for `custom_fields` updates -> gives example of date and date-time values | Low | 9/13/2023 |
| 4.0.10 | - Fix search_tasks_for_workspace custom fields query not working for is_set, value, starts_with, ends_with, less_than, greater_than | Low | 8/30/2023 |
| 4.0.9 | - Fix not being able to search using custom fields query for searchTasksForWorkspace method | Low | 8/29/2023 |
| 4.0.8 | - Added `minimum_access_level_for_customization` and `minimum_access_level_for_sharing` to the project schema - Added `completed_since` as a query param to [GET /sections/{section_gid}/tasks](https://developers.asana.com/reference/gettasksforsection) | Low | 8/25/2023 |
| 4.0.7 | - [Handle multiprocessing.pool init](https://github.com/Asana/python-asana/commit/4bef19277e28e40f04b79bfac8b54ccb3df6c281) - Sync with API/Developer Docs: Removed required `text` and `color` from `ProjectStatusBase` which caused problems in developer docs -> Update a Project endpoint | Low | 8/17/2023 |
| 4.0.6 | - Fix IndentationError: Updated api.mustache template file to generate api classes with out indentation errors. ([issue](https://github.com/Asana/python-asana/issues/175)) | Low | 8/14/2023 |
| 4.0.5 | README.md + Sample code changes - Update tab spacing in sample code and README.md from 2 to 4 spaces - Separate call_api examples in README.md - Add instructions on how to paginate with next_page response data in README.md - Add instructions on how to access response data in README.md - Add instructions on how to get events in README.md - Add instructions on how to set asana-enable header to README.md - Add instructions on how to access status and headers from response to README.md - Upd | Low | 8/11/2023 |
| 4.0.4 | - Sync with API/Developer Docs: Added `created_by` property to task response | Low | 8/4/2023 |
| 4.0.3 | - Fix indentation on code samples template | Low | 8/3/2023 |
| 4.0.2 | - Update Github Action: add tags to update pushes and update gh-action-pypi-publish release version | Low | 8/2/2023 |
| 4.0.1 | v4.0.0 - Completely new python client library. Code generated through Swagger Codegen. - Improves internal release process -> allows Asana to keep python client library in sync with the API more frequently - Introduces classes for resources. Responses return resource objects and data can be accessed via dot notation - Sample code documentation is more rich - Synced with latest API changes since Apr 18, 2023 v4.0.1 - Add missing quotes to version in custom Asana header | Low | 7/31/2023 |
| v3.2.1 | Releasing version 3.2.1 | Low | 4/13/2023 |
| v3.2.0 | Releasing version 3.2.0 | Low | 3/24/2023 |
| v3.1.1 | - Added memberships endpoints | Low | 2/24/2023 |
| v3.1.0 | - removed `delete_status_message` method | Low | 2/8/2023 |
| v3.0.0 | - Drop support for python 3.6 and below - Added Message and Memberships resources | Low | 12/22/2022 |
| v2.0.0 | - Added goal relationships - Removed goals methods: `add_subgoal`, `add_supporting_work_for_goal`, `get_subgoals_for_goal`, `remove_subgoal`, `remove_supporting_work_for_goal`, `supporting_work` | Low | 10/15/2022 |
| v1.0.0 | - Adds support for `/attachment` endpoints. Note: Attachments are no longer tied to a task - `POST /tasks/:task/attachments` -> `POST /attachments?parent=` - `GET /tasks/:task/attachments` -> `GET /attachments?parent=` - Adds `goal_id` request parameter for Goals-related endpoints - Adds support for `GET /workspaces/{workspace_gid}/teams`. Note: Removes support for getting teams in an organization | Low | 6/30/2022 |
| v0.10.13 | - Removed Travis CI and added GitHub Actions | Low | 4/14/2022 |
| v0.10.12 | - Fix `get_audit_log_events` | Low | 4/11/2022 |
| v0.10.11 | Fix support for: - audit_log_api - goals - project_briefs - project_templates - status_updates - time_periods | Low | 3/21/2022 |
| v0.10.10 | - Add support for Project Templates API | Low | 3/4/2022 |
| v0.10.9 | - Adds support for Project Brief API (*preview) - Adds support for Status Updates | Low | 1/26/2022 |
| v0.10.8 | Adds support for Audit Log API | Low | 10/20/2021 |
| v0.10.7 | - Adds support for updating webhooks | Low | 9/28/2021 |
| v0.10.6 | - Adds `POST /goals` - Adds Time Periods | Low | 8/23/2021 |
| v0.10.5 | Adds support for Goals endpoints. | Low | 8/6/2021 |
| v0.10.4 | Syncing with the latest OpenAPI spec | Low | 4/15/2021 |
| v0.10.3 | Added create_attachment_for_task to the attachments resource. | Low | 10/5/2020 |
| v0.10.2 | Fixes BatchAPI being ignored on the client. | Low | 9/8/2020 |
| v0.10.1 | Added team_memberships to resources | Low | 8/25/2020 |
