{"id":18783910,"url":"https://github.com/sparkpost/python-sparkpost","last_synced_at":"2025-10-25T19:38:45.555Z","repository":{"id":26600552,"uuid":"30055479","full_name":"SparkPost/python-sparkpost","owner":"SparkPost","description":"SparkPost client library for Python","archived":false,"fork":false,"pushed_at":"2023-05-22T21:49:27.000Z","size":320,"stargazers_count":94,"open_issues_count":27,"forks_count":70,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-03-28T18:08:12.151Z","etag":null,"topics":["django","email","python","sparkpost"],"latest_commit_sha":null,"homepage":"https://www.sparkpost.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SparkPost.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-01-30T04:03:38.000Z","updated_at":"2025-03-12T17:13:25.000Z","dependencies_parsed_at":"2024-06-18T15:41:32.787Z","dependency_job_id":null,"html_url":"https://github.com/SparkPost/python-sparkpost","commit_stats":{"total_commits":276,"total_committers":47,"mean_commits":5.872340425531915,"dds":0.6884057971014492,"last_synced_commit":"a0a5b337b3510aa7e8ee78dc06c1d44f9c7be7af"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SparkPost%2Fpython-sparkpost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SparkPost%2Fpython-sparkpost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SparkPost%2Fpython-sparkpost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SparkPost%2Fpython-sparkpost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SparkPost","download_url":"https://codeload.github.com/SparkPost/python-sparkpost/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"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":["django","email","python","sparkpost"],"created_at":"2024-11-07T20:41:08.662Z","updated_at":"2025-10-25T19:38:45.497Z","avatar_url":"https://github.com/SparkPost.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. image:: https://www.sparkpost.com/sites/default/files/attachments/SparkPost_Logo_2-Color_Gray-Orange_RGB.svg\n    :target: https://www.sparkpost.com\n    :width: 200px\n\n`Sign up`_ for a SparkPost account and visit our `Developer Hub`_ for even more content.\n\n.. _Sign up: https://app.sparkpost.com/join?plan=free-0817?src=Social%20Media\u0026sfdcid=70160000000pqBb\u0026pc=GitHubSignUp\u0026utm_source=github\u0026utm_medium=social-media\u0026utm_campaign=github\u0026utm_content=sign-up\n.. _Developer Hub: https://developers.sparkpost.com\n\nSparkPost Python API client\n===========================\n\n.. image:: https://travis-ci.org/SparkPost/python-sparkpost.svg?branch=master\n    :target: https://travis-ci.org/SparkPost/python-sparkpost\n    :alt: Build Status\n\n.. image:: https://readthedocs.org/projects/python-sparkpost/badge/?version=latest\n    :target: https://python-sparkpost.readthedocs.io/en/latest/\n    :alt: Documentation Status\n\n.. image:: https://coveralls.io/repos/SparkPost/python-sparkpost/badge.svg?branch=master\u0026service=github\n    :target: https://coveralls.io/github/SparkPost/python-sparkpost?branch=master\n    :alt: Coverage Status\n\n\nThe official Python package for using the SparkPost API.\n\nDocumentation\n-------------\n\n* Documentation for `python-sparkpost`_\n* `SparkPost API Reference`_\n\n.. _python-sparkpost: https://python-sparkpost.readthedocs.io/\n.. _SparkPost API Reference: https://www.sparkpost.com/api\n\nInstallation\n------------\n\nInstall from PyPI using `pip`_:\n\n.. code-block:: bash\n\n    $ pip install sparkpost\n\n.. _pip: http://www.pip-installer.org/en/latest/\n\n.. _pip: http://www.pip-installer.org/en/latest/\n\nPython 2.7 or later is required.\n\nGet a key\n---------\n\nGo to `API \u0026 SMTP`_ in the SparkPost app and create an API key. We recommend using the ``SPARKPOST_API_KEY`` environment variable:\n\n.. code-block:: python\n\n    from sparkpost import SparkPost\n    sp = SparkPost() # uses environment variable\n\nAlternatively, you can pass the API key to the SparkPost class:\n\n.. code-block:: python\n\n    from sparkpost import SparkPost\n    sp = SparkPost('YOUR API KEY')\n\nFor SparkPost EU and Enterprise accounts, pass in a second parameter to set the API host.\n\n.. code-block:: python\n\n    from sparkpost import SparkPost\n    sp = SparkPost('YOUR API KEY', 'https://api.eu.sparkpost.com')\n\n.. _API \u0026 SMTP: https://app.sparkpost.com/#/configuration/credentials\n\n\nSend a message\n--------------\n\nHere at SparkPost, our messages are known as transmissions. Let's use the underlying `transmissions API`_ to send a friendly test message:\n\n.. code-block:: python\n\n    from sparkpost import SparkPost\n\n    sp = SparkPost()\n\n    response = sp.transmissions.send(\n        use_sandbox=True,\n        recipients=['someone@somedomain.com'],\n        html='\u003cp\u003eHello world\u003c/p\u003e',\n        from_email='test@sparkpostbox.com',\n        subject='Hello from python-sparkpost'\n    )\n\n    print(response)\n    # outputs {u'total_accepted_recipients': 1, u'id': u'47960765679942446', u'total_rejected_recipients': 0}\n\n.. _transmissions API: https://www.sparkpost.com/api#/reference/transmissions\n\nDjango Integration\n------------------\nThe SparkPost python library comes with an email backend for Django. Put the following configuration in `settings.py` file.\n\n.. code-block:: python\n\n    SPARKPOST_API_KEY = 'API_KEY'\n    SPARKPOST_BASE_URI = 'api.sparkpost.com'\n    EMAIL_BACKEND = 'sparkpost.django.email_backend.SparkPostEmailBackend'\n\nReplace *API_KEY* with an actual API key that you've generated in `Get a Key`_ section. Check out the `full documentation`_ on the Django email backend.\n\nIf you are using an EU account, set *SPARKPOST_BASE_URI* to `api.eu.sparkpost.com`. The default value is `api.sparkpost.com`.\n\n.. _full documentation: https://python-sparkpost.readthedocs.io/en/latest/django/backend.html\n\nUsing with Google Cloud\n-----------------------\nThere are a few simple modifications necessary to enable the use of the underlying ``requests`` library that python-sparkpost uses. First, add the ``requests`` and ``requests-toolbelt`` to your project's ``requirements.txt``:\n\n.. code-block::\n\n    requests\n    requests-toolbelt\n\nThen create or update your ``appengine_config.py`` file to include the following:\n\n.. code-block:: python\n\n    import requests\n    import requests_toolbelt.adapters.appengine\n\n    requests_toolbelt.adapters.appengine.monkeypatch()\n\nThen deploy your app and you should be able to send using python-sparkpost on Google Cloud.\n\nContribute\n----------\n\n#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.\n#. Fork `the repository`_ on GitHub and make your changes in a branch on your fork\n#. Write a test which shows that the bug was fixed or that the feature works as expected.\n#. Send a pull request. Make sure to add yourself to AUTHORS_.\n\n.. _`the repository`: http://github.com/SparkPost/python-sparkpost\n.. _AUTHORS: https://github.com/SparkPost/python-sparkpost/blob/master/AUTHORS.rst\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparkpost%2Fpython-sparkpost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsparkpost%2Fpython-sparkpost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparkpost%2Fpython-sparkpost/lists"}