{"id":22484,"library":"twitter-ads","title":"Twitter Ads API SDK for Python","description":"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.","status":"active","version":"11.0.0","language":"python","source_language":"en","source_url":"https://github.com/twitterdev/twitter-python-ads-sdk","tags":["twitter","ads","sdk","marketing"],"install":[{"cmd":"pip install twitter-ads","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Client is the main entry point, not a top-level import.","wrong":"import twitter_ads","symbol":"Client","correct":"from twitter_ads.client import Client"},{"note":"","wrong":"","symbol":"Account","correct":"from twitter_ads.account import Account"}],"quickstart":{"code":"import os\nfrom twitter_ads.client import Client\n\nCONSUMER_KEY = os.environ.get('CONSUMER_KEY', '')\nCONSUMER_SECRET = os.environ.get('CONSUMER_SECRET', '')\nACCESS_TOKEN = os.environ.get('ACCESS_TOKEN', '')\nACCESS_TOKEN_SECRET = os.environ.get('ACCESS_TOKEN_SECRET', '')\n\nclient = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET)\nprint(client.accounts.all())","lang":"python","description":"Initialize client and list all accounts."},"warnings":[{"fix":"Upgrade Python to 3.6+ or pin to twitter-ads<=9.x if Python 2.7 required.","message":"Version 10.0.0 dropped support for Python 2.7 and Python 3.5. Ensure Python 3.6+ is used.","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Update instantiation to match new parameter order.","message":"OAuth1 authentication parameters changed order in version 9.0.0. Client constructor now expects (consumer_key, consumer_secret, access_token, access_token_secret).","severity":"breaking","affected_versions":">=9.0.0"},{"fix":"Fetch account ID from the accounts listing or pass the correct account_id string.","message":"Account ID is required for most API calls and is not automatically derived from credentials. Must be retrieved via client.accounts.all().","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'pip install twitter-ads' and ensure virtual environment is activated.","cause":"Package not installed or installed in wrong environment.","error":"ImportError: No module named 'twitter_ads'"},{"fix":"Provide all four OAuth1 credentials: consumer_key, consumer_secret, access_token, access_token_secret.","cause":"Old instantiation pattern with only two arguments (consumer key/secret) used in OAuth2 flow but API requires OAuth1 with four tokens.","error":"twitter_ads.client.Client() missing 2 required positional arguments: 'access_token' and 'access_token_secret'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}