{"id":18318768,"url":"https://github.com/xdevplatform/twitter-python-ads-sdk","last_synced_at":"2025-12-13T22:03:09.422Z","repository":{"id":37773889,"uuid":"41500706","full_name":"xdevplatform/twitter-python-ads-sdk","owner":"xdevplatform","description":"A Twitter supported and maintained Ads API SDK for Python.","archived":false,"fork":false,"pushed_at":"2022-05-27T22:48:53.000Z","size":1072,"stargazers_count":190,"open_issues_count":24,"forks_count":108,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-02-22T22:51:20.479Z","etag":null,"topics":["python","sdk","twitter","twitter-ads","twitter-api"],"latest_commit_sha":null,"homepage":"https://twitterdev.github.io/twitter-python-ads-sdk/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xdevplatform.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-27T17:16:13.000Z","updated_at":"2025-01-04T02:04:07.000Z","dependencies_parsed_at":"2022-08-08T22:00:53.011Z","dependency_job_id":null,"html_url":"https://github.com/xdevplatform/twitter-python-ads-sdk","commit_stats":null,"previous_names":["xdevplatform/twitter-python-ads-sdk"],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdevplatform%2Ftwitter-python-ads-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdevplatform%2Ftwitter-python-ads-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdevplatform%2Ftwitter-python-ads-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdevplatform%2Ftwitter-python-ads-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xdevplatform","download_url":"https://codeload.github.com/xdevplatform/twitter-python-ads-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299768,"owners_count":20916183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","sdk","twitter","twitter-ads","twitter-api"],"created_at":"2024-11-05T18:11:30.672Z","updated_at":"2025-12-13T22:03:04.068Z","avatar_url":"https://github.com/xdevplatform.png","language":"Python","readme":"Getting Started |Build Status| |Code Climate| |PyPy Version|\n------------------------------------------------------------\n\nInstallation\n''''''''''''\n\n.. code:: bash\n\n    # installing the latest signed release\n    pip install twitter-ads\n\nQuick Start\n'''''''''''\n\n.. code:: python\n\n    from twitter_ads.client import Client\n    from twitter_ads.campaign import Campaign\n    from twitter_ads.enum import ENTITY_STATUS\n\n    CONSUMER_KEY = 'your consumer key'\n    CONSUMER_SECRET = 'your consumer secret'\n    ACCESS_TOKEN = 'access token'\n    ACCESS_TOKEN_SECRET = 'access token secret'\n    ACCOUNT_ID = 'account id'\n\n    # initialize the client\n    client = Client(\n        CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET)\n\n    # load the advertiser account instance\n    account = client.accounts(ACCOUNT_ID)\n\n    # load and update a specific campaign\n    campaign = account.campaigns().next()\n    campaign.name = 'updated campaign name'\n    campaign.entity_status = ENTITY_STATUS.PAUSED\n    campaign.save()\n\n    # iterate through campaigns\n    for campaign in account.campaigns():\n        print(campaign.id)\n\n\n\nCommand Line Helper\n'''''''''''''''''''\n\n.. code:: bash\n\n    # The twitter-ads command launches an interactive session for testing purposes\n    # with a client instance automatically loaded from your .twurlrc file.\n\n    ~ ❯ twitter-ads\n\nFor more help please see our `Examples and Guides`_ or check the online\n`Reference Documentation`_.\n\nRate-limit handling and request options\n'''''''''''''''''''\n\n.. code:: python\n\n    client = Client(\n        CONSUMER_KEY,\n        CONSUMER_SECRET,\n        ACCESS_TOKEN,\n        ACCESS_TOKEN_SECRET,\n        options={\n            'handle_rate_limit': True,\n            'retry_max': 3,\n            'retry_delay': 5000,\n            'retry_on_status': [404, 500, 503],\n            'retry_on_timeouts': True,\n            'timeout': (1.0, 3.0)\n        })\n\n\n.. list-table::\n\n   * - Parameter\n     - Default\n     - Description\n   * - ``handle_rate_limit``\n     - ``False`` (boolean)\n     - Set ``True`` will check rate-limit response header and sleep if the request reached the limit (429).\n   * - ``retry_max``\n     - ``0`` (int)\n     - The number of times you want to retry when response code is found in ``retry_on_status``.\n   * - ``retry_delay``\n     - ``1500`` (int)\n     - The number of **milliseconds** you want to sleep before retry.\n   * - ``retry_on_status``\n     - ``[500, 503]`` (list)\n     - The response codes you want to retry on. You can only set \u003e= 400 status codes.\n   * - ``retry_on_timeouts``\n     - ``False`` (boolean)\n     - Set ``True`` will catch the timeout error and retry the request.\n   * - ``timeout``\n     - ``None``\n     - You can specify either a single value OR a tuple. If a single value is specified, the timeout value will be applied to both the ``connect`` and the ``read`` timeouts. See https://2.python-requests.org/en/master/user/advanced/#timeouts for more details of the usage.\n\nCompatibility \u0026 Versioning\n--------------------------\n\nThis project is designed to work with Python 3.5 or greater. While it\nmay work on other version of Python, below are the platform and runtime\nversions we officially support and regularly test against.\n\n+------------+-------------------------+\n| Platform   | Versions                |\n+============+=========================+\n| CPython    | 3.5, 3.6, 3.7           |\n+------------+-------------------------+\n| PyPy       | 7.x                     |\n+------------+-------------------------+\n\nAll releases adhere to strict `semantic versioning`_. For Example,\nmajor.minor.patch-pre (aka. stick.carrot.oops-peek).\n\nDevelopment\n-----------\n\nIf you’d like to contribute to the project or try an unreleased\ndevelopment version of this project locally, you can do so quite easily\nby following the examples below.\n\n.. code:: bash\n\n    # clone the repository\n    git clone git@github.com:twitterdev/twitter-python-ads-sdk.git\n    cd twitter-python-ads-sdk\n\n    # install dependencies\n    pip install -r requirements.txt\n\n    # installing a local unsigned release\n    pip install -e .\n\nWe love community contributions! If you’re planning to send us a pull\nrequest, please make sure read our `Contributing Guidelines`_ first.\n\nFeedback and Bug Reports\n------------------------\n\nFound an issue? Please open up a `GitHub issue`_ or even better yet\n`send us`_ a pull request. Have a question? Want to discuss a new\nfeature? Come chat with us in the `Twitter Community Forums`_.\n\nError Handling\n--------------\n\nLike the `Response`_ and `Request`_ classes, the Ads API SDK fully models\nall `error objects`_ for easy error handling.\n\n|error-hierarchy|\n\nLicense\n-------\n\nThe MIT License (MIT)\n\nCopyright (C) 2015 Twitter, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n.. _Examples and Guides: https://github.com/twitterdev/twitter-python-ads-sdk/tree/master/examples\n.. _Reference Documentation: http://twitterdev.github.io/twitter-python-ads-sdk/reference/index.html\n.. _semantic versioning: http://semver.org\n.. _Contributing Guidelines: https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/CONTRIBUTING.rst\n.. _GitHub issue: https://github.com/twitterdev/twitter-python-ads-sdk/issues\n.. _send us: https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/CONTRIBUTING.rst\n.. _Twitter Community Forums: https://twittercommunity.com/c/advertiser-api\n\n.. |Build Status| image:: https://travis-ci.org/twitterdev/twitter-python-ads-sdk.svg?branch=master\n   :target: https://travis-ci.org/twitterdev/twitter-python-ads-sdk\n.. |Code Climate| image:: https://codeclimate.com/github/twitterdev/twitter-python-ads-sdk/badges/gpa.svg\n   :target: https://codeclimate.com/github/twitterdev/twitter-python-ads-sdk\n.. |PyPy Version| image:: https://badge.fury.io/py/twitter-ads.svg\n   :target: http://badge.fury.io/py/twitter-ads\n\n.. _Request: https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/twitter_ads/http.py#L28\n.. _Response: https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/twitter_ads/http.py#L118\n.. _error objects: https://github.com/twitterdev/twitter-python-ads-sdk/blob/master/twitter_ads/error.py\n.. |error-hierarchy| image:: http://i.imgur.com/XcLDWLO.png\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxdevplatform%2Ftwitter-python-ads-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxdevplatform%2Ftwitter-python-ads-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxdevplatform%2Ftwitter-python-ads-sdk/lists"}