Registry / communication / twitter-ads

twitter-ads

JSON →
library11.0.0pypypi✓ verified 89d ago

A Twitter supported and maintained Ads API SDK for Python, version 11.0.0. Provides programmatic access to Twitter Ads campaigns, analytics, and targeting. Release cadence is irregular.

pip install twitter-ads
INSTALL
IMPORT
SIG · TWITTER-ADS
T
twitter-ads
communicationpythonv11.0.0
Install
2.6s avg
Import
710ms
Disk
25MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v11.0.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.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.756s · 25.9MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.6s · import 0.664s · 27MB
25MB installed
● package 25MB
Code
Verified usage

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

Client
✓ from twitter_ads.client import Client
✗ import twitter_ads
Client is the main entry point, not a top-level import.
Account
✓ from twitter_ads.account import Account

Initialize client and list all accounts.

import os from twitter_ads.client import Client CONSUMER_KEY = os.environ.get('CONSUMER_KEY', '') CONSUMER_SECRET = os.environ.get('CONSUMER_SECRET', '') ACCESS_TOKEN = os.environ.get('ACCESS_TOKEN', '') ACCESS_TOKEN_SECRET = os.environ.get('ACCESS_TOKEN_SECRET', '') client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET) print(client.accounts.all())
Debug
Known issues
breakingVersion 10.0.0 dropped support for Python 2.7 and Python 3.5. Ensure Python 3.6+ is used.
fix
Upgrade Python to 3.6+ or pin to twitter-ads<=9.x if Python 2.7 required.
affects: >=10.0.0
breakingOAuth1 authentication parameters changed order in version 9.0.0. Client constructor now expects (consumer_key, consumer_secret, access_token, access_token_secret).
fix
Update instantiation to match new parameter order.
affects: >=9.0.0
gotchaAccount ID is required for most API calls and is not automatically derived from credentials. Must be retrieved via client.accounts.all().
fix
Fetch account ID from the accounts listing or pass the correct account_id string.
affects: all
Errors
Common errors & fixes
ImportError: No module named 'twitter_ads'
Package not installed or installed in wrong environment.
fix
Run 'pip install twitter-ads' and ensure virtual environment is activated.
twitter_ads.client.Client() missing 2 required positional arguments: 'access_token' and 'access_token_secret'
Old instantiation pattern with only two arguments (consumer key/secret) used in OAuth2 flow but API requires OAuth1 with four tokens.
fix
Provide all four OAuth1 credentials: consumer_key, consumer_secret, access_token, access_token_secret.
Upgrade
Version history
11.0.0latest on PyPI · released May 27, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
32 hits · last 30 days
node
30
OpenAI (training)
1
Resources
twitter-ads — pip install twitter-ads · libregistry