Registry / crm-productivity / asana
library5.3.0pypypi✓ verified 24d ago

The official Python client library for interacting with the Asana API. It provides a simple interface to access Asana resources like tasks, projects, users, and workspaces. The current version is 5.2.4, and the library receives frequent updates, typically focusing on adding support for new API endpoints.

pip install asana
INSTALL
IMPORT
SIG · ASANA
A
asana
crm-productivitypythonv5.3.0
Install
2.1s avg
Import
371ms
Disk
22MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.384s · 23.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.1s · import 0.358s · 24MB
22MB installed
● package 22MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ApiClient
from asana import ApiClient
import asana

This quickstart demonstrates how to initialize the Asana client using a Personal Access Token (PAT) and fetch the current user's details and a list of accessible workspaces. It handles token retrieval from environment variables for security and includes basic error handling.

import asana import os # Get your Personal Access Token from environment variable for security personal_access_token = os.environ.get('ASANA_ACCESS_TOKEN', 'YOUR_ASANA_PAT') if not personal_access_token or personal_access_token == 'YOUR_ASANA_PAT': print("Please set the ASANA_ACCESS_TOKEN environment variable or replace 'YOUR_ASANA_PAT' with your token.") else: try: # Construct an Asana client client = asana.Client.access_token(personal_access_token) # Get information about the current user ('me') me = client.users.get_user('me') print(f"Connected as: {me['name']} (ID: {me['gid']})") # List workspaces accessible by the user workspaces = client.workspaces.get_workspaces(iterator_type=None) # iterator_type=None to get all results directly print("Workspaces:") for ws in workspaces: print(f"- {ws['name']} (ID: {ws['gid']})") except asana.error.NoAuthorizationError: print("Error: Invalid or expired Asana Personal Access Token.") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingMajor API changes in v4.0.0 altered client instantiation and resource method names. Older versions (pre-v4) used different patterns like `client.Client(api_key='...')` and resource methods such as `find_all` or `find_by_id`.
fix
Update client instantiation to `asana.Client.access_token('YOUR_PAT')` or `asana.Client.oauth(...)`. Replace old resource methods (`projects.find_all`) with their v4+ equivalents (`projects.get_projects`). Consult the official v4 migration guide if available, or the current documentation.
affects: <4.0.0
gotchaMany collection-fetching methods (e.g., `get_tasks`, `get_projects`) return an `asana.Collection` object. This object is an iterator and does not immediately contain all results. To retrieve all items, you must iterate over it or explicitly request all results.
fix
To iterate through results: `for item in client.tasks.get_tasks(...)`. To get all results as a list (for smaller collections, use with caution for large ones): `list(client.tasks.get_tasks(...))` or pass `iterator_type=None` to the method, e.g., `client.tasks.get_tasks(workspace_gid, iterator_type=None)`.
affects: >=4.0.0
gotchaAsana API responses can be verbose. To optimize performance and reduce data transfer, always use the `opt_fields` parameter to specify only the fields you need in the response.
fix
When calling any `get_` method for resources, pass a list of desired fields to `opt_fields`. Example: `task = client.tasks.get_task(task_gid, opt_fields=['name', 'notes', 'assignee.name'])`. This also applies to collection fetching methods.
affects: All
breakingThe Asana client requires a valid Personal Access Token (PAT) for authentication. The error 'Please set the ASANA_ACCESS_TOKEN environment variable or replace 'YOUR_ASANA_PAT' with your token' indicates that the token was either not provided, or the placeholder value was still in use.
fix
Ensure your Personal Access Token is correctly set. You can either replace `'YOUR_ASANA_PAT'` directly in your code with your actual token, or set the `ASANA_ACCESS_TOKEN` environment variable before running your application. For example, `client = asana.Client.access_token(os.environ['ASANA_ACCESS_TOKEN'])`.
affects: >=4.0.0
breakingClient instantiation requires a valid Personal Access Token (PAT) or OAuth credentials to authenticate with the Asana API. The error indicates that either the `ASANA_ACCESS_TOKEN` environment variable was not set, or a placeholder token in the client instantiation code (e.g., 'YOUR_PAT') was not replaced with an actual token.
fix
Ensure the `ASANA_ACCESS_TOKEN` environment variable is set to your Asana Personal Access Token, or replace the placeholder token (e.g., 'YOUR_PAT') in your client instantiation code with your actual Asana Personal Access Token. For OAuth, ensure the OAuth flow is correctly implemented to obtain and use credentials.
affects: >=4.0.0
Upgrade
Version history
5.3.0latest on PyPI · released Aug 27, 2026
Audit
Dependencies
requestsrequiredHTTP client for making API requests.
oauthliboptionalRequired for OAuth 2.0 authentication flow.
requests_oauthliboptionalProvides OAuth 2.0 support for requests.
Agent activity
64 hits · last 30 days
node
50
OpenAI (training)
1
Resources
asana — pip install asana · libregistry