[Python-modules-commits] [python-sparkpost] 01/03: import python-sparkpost_1.3.2.orig.tar.gz

Scott Kitterman kitterman at moszumanska.debian.org
Thu Nov 17 06:41:46 UTC 2016


This is an automated email from the git hooks/post-receive script.

kitterman pushed a commit to branch master
in repository python-sparkpost.

commit de4900c79d3a6d4745e1db30af2ae8779b8f2454
Author: Scott Kitterman <scott at kitterman.com>
Date:   Thu Nov 17 01:04:11 2016 -0500

    import python-sparkpost_1.3.2.orig.tar.gz
---
 .editorconfig                                      |  11 +
 .gitignore                                         |  65 ++++
 .travis.yml                                        |  28 ++
 AUTHORS.rst                                        |  24 ++
 CHANGELOG.md                                       | 131 ++++++++
 CONTRIBUTING.md                                    |  74 +++++
 LICENSE                                            |  13 +
 MANIFEST.in                                        |   1 +
 Makefile                                           |  38 +++
 README.rst                                         | 141 +++++++++
 dev-requirements.txt                               |   5 +
 docs/Makefile                                      | 177 +++++++++++
 docs/api.rst                                       |  11 +
 docs/api/recipient_lists.rst                       |   7 +
 docs/api/suppression_list.rst                      |   7 +
 docs/api/templates.rst                             |   7 +
 docs/api/transmissions.rst                         |   7 +
 docs/conf.py                                       | 271 ++++++++++++++++
 docs/django/backend.rst                            |  99 ++++++
 docs/index.rst                                     |  89 ++++++
 docs/make.bat                                      | 242 +++++++++++++++
 docs/requirements.txt                              |   2 +
 docs/resources/metrics.rst                         |  34 ++
 docs/resources/recipient_lists.rst                 |  83 +++++
 docs/resources/suppression_list.rst                |  68 ++++
 docs/resources/templates.rst                       |  69 +++++
 docs/resources/transmissions.rst                   | 200 ++++++++++++
 examples/recipient_lists/create_recipient_list.py  |  25 ++
 examples/recipient_lists/delete_recipient_list.py  |   5 +
 examples/recipient_lists/get_recipient_list.py     |   5 +
 .../get_recipient_list_with_recipients.py          |   5 +
 examples/recipient_lists/list_recipient_lists.py   |   5 +
 examples/recipient_lists/update_recipient_list.py  |  25 ++
 .../create_suppression_entries_bulk.py             |  25 ++
 .../suppression_list/create_suppression_entry.py   |  10 +
 .../suppression_list/delete_suppression_entry.py   |   5 +
 examples/suppression_list/get_suppression_entry.py |   5 +
 .../suppression_list/list_suppression_entries.py   |   9 +
 .../update_suppression_entries_bulk.py             |  25 ++
 .../suppression_list/update_suppression_enty.py    |  10 +
 examples/templates/create_template.py              |  13 +
 examples/templates/delete_template.py              |   5 +
 examples/templates/get_template.py                 |   5 +
 examples/templates/list_templates.py               |   5 +
 examples/templates/preview_draft_template.py       |   9 +
 examples/templates/preview_template.py             |   9 +
 examples/templates/update_template.py              |  11 +
 examples/transmissions/a-file.txt                  |   1 +
 examples/transmissions/find_transmission.py        |   5 +
 examples/transmissions/get_transmissions.py        |   5 +
 examples/transmissions/schedule_transmission.py    |  37 +++
 examples/transmissions/send_transmission.py        |  49 +++
 examples/transmissions/transmission_stored_list.py |  24 ++
 .../transmissions/transmission_stored_template.py  |   9 +
 setup.cfg                                          |   2 +
 setup.py                                           |  29 ++
 sparkpost/__init__.py                              |  45 +++
 sparkpost/base.py                                  |  57 ++++
 sparkpost/django/__init__.py                       |   0
 sparkpost/django/email_backend.py                  |  39 +++
 sparkpost/django/exceptions.py                     |   6 +
 sparkpost/django/message.py                        |  90 ++++++
 sparkpost/exceptions.py                            |  32 ++
 sparkpost/metrics.py                               |  26 ++
 sparkpost/recipient_lists.py                       | 105 +++++++
 sparkpost/suppression_list.py                      | 110 +++++++
 sparkpost/templates.py                             | 183 +++++++++++
 sparkpost/tornado/__init__.py                      |  18 ++
 sparkpost/tornado/base.py                          |  31 ++
 sparkpost/tornado/exceptions.py                    |  31 ++
 sparkpost/tornado/transmissions.py                 |   8 +
 sparkpost/tornado/utils.py                         |  14 +
 sparkpost/transmissions.py                         | 290 ++++++++++++++++++
 test-requirements.txt                              |   5 +
 test/__init__.py                                   |   0
 test/assets/sparkpostdev.png                       | Bin 0 -> 6550 bytes
 test/django/__init__.py                            |   0
 test/django/test_email_backend.py                  | 226 ++++++++++++++
 test/django/test_message.py                        | 219 +++++++++++++
 test/django/utils.py                               |   7 +
 test/test_base.py                                  | 122 ++++++++
 test/test_init.py                                  |   9 +
 test/test_metrics.py                               |  65 ++++
 test/test_recipient_lists.py                       | 163 ++++++++++
 test/test_suppression_list.py                      | 173 +++++++++++
 test/test_templates.py                             | 217 +++++++++++++
 test/test_transmissions.py                         | 341 +++++++++++++++++++++
 test/tornado/__init__.py                           |   0
 test/tornado/test_tornado.py                       | 193 ++++++++++++
 test/tornado/utils.py                              |  46 +++
 tox.ini                                            |  17 +
 91 files changed, 5169 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..d6a26d5
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,11 @@
+root = true
+
+[*]
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.py]
+indent_style = space
+indent_size = 4
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6d2c1f9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,65 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+#  Usually these files are written by a python script from a template
+#  before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.cache
+nosetests.xml
+coverage.xml
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# virtualenv
+venv/
+
+# autoenv
+.env
+
+# Mac OSX
+.DS_Store
+.idea
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..e630188
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,28 @@
+language: python
+python:
+  - "2.7"
+  - "3.4"
+  - "3.5"
+env:
+  - DJANGO_VERSION='>=1.7,<1.8'
+  - DJANGO_VERSION='>=1.8,<1.9'
+  - DJANGO_VERSION='>=1.9,<1.10'
+matrix:
+  exclude:
+    - python: "3.5"
+      env: DJANGO_VERSION='>=1.7,<1.8'
+install:
+  - pip install -r dev-requirements.txt
+  - pip uninstall django --yes
+  - pip install -q django$DJANGO_VERSION
+  - pip install coveralls
+  - pip install -e .
+before_script:
+  - flake8 sparkpost test
+script:
+  - py.test --cov sparkpost test/ --cov-report term-missing
+after_success:
+  - coveralls
+notifications:
+  slack:
+    secure: VNIwgvrbcwj0b2gfYSOeTyK7rkV62/belwhYthasHmN+DoTsEJF4+HFVtzOykS72LM/f5Id5zieWtxYG+soy+yEOc1iZizXRpRJORtTYfZJB9RCffavosl322BcpoTX99cGyiZjWjOFH70UWlFMB3zT0jS+9icuTfk7ZqBX/zDA=
diff --git a/AUTHORS.rst b/AUTHORS.rst
new file mode 100644
index 0000000..697d4b4
--- /dev/null
+++ b/AUTHORS.rst
@@ -0,0 +1,24 @@
+Core contributors
+-----------------
+
+- Bob Evans <bob.evans at sparkpost.com> `@bizob2828 <https://github.com/bizob2828>`_
+- Aydrian Howard <aydrian.howard at sparkpost.com> `@aydrian <https://github.com/aydrian>`_
+- Rich Leland <rich.leland at sparkpost.com> `@richleland <https://github.com/richleland>`_
+
+
+Patches and suggestions
+-----------------------
+
+- Artur Felipe Sousa `@arturfelipe <https://github.com/arturfelipe>`_
+- Barthelemy Dagenais `@bartdag <https://github.com/bartdag>`_
+- Dmitry Tyukin `@deems <https://github.com/deems>`_
+- Jared Morse `@jarcoal <https://github.com/jarcoal>`_
+- Marko Mrdjenovic `@friedcell <https://github.com/friedcell>`_
+- Mohammad Hossain `@rajumsys <https://github.com/rajumsys>`_
+- Simeon Visser `@svisser <https://github.com/svisser>`_
+- Zdeněk Softič `@btx <https://github.com/btx>`_
+- `@amatissart <https://github.com/amatissart>`_
+- `@gnarvaja <https://github.com/gnarvaja>`_
+- `@pegler <https://github.com/pegler>`_
+- `@puttu <https://github.com/puttu>`_
+- ADD YOURSELF HERE (and link to your github page)
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..9c57adf
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,131 @@
+# Change Log
+All notable changes to this project will be documented in this file.
+This project adheres to [Semantic Versioning](http://semver.org/).
+
+## Unreleased
+- [Compare to latest release][unreleased]
+
+## [1.3.2] - 2016-11-14
+### Fixed
+- [#129](https://github.com/SparkPost/python-sparkpost/pull/129) Reverted change for emojis in the body of a message, needs further investigation
+- [#129](https://github.com/SparkPost/python-sparkpost/pull/129) `substitution_data`, `metadata`, and `tags` are now supplied properly for cc/bcc recipients
+
+
+## [1.3.1] - 2016-11-13
+### Added
+- Instructions for use with Google Cloud
+
+### Fixed
+- [#114](https://github.com/SparkPost/python-sparkpost/pull/114) Issue where emojis in the body of a message were being forced to ASCII
+- [#118](https://github.com/SparkPost/python-sparkpost/pull/118) Fixed improper setting of header_to value when using cc and primary recipient has substitution data
+- [#119](https://github.com/SparkPost/python-sparkpost/pull/119) Added missing `sources` to suppression list key map
+
+
+## [1.3.0] - 2016-10-01
+### Added
+- [#121](https://github.com/SparkPost/python-sparkpost/pull/121) Added extended error code to `SparkPostAPIException` class
+- [#124](https://github.com/SparkPost/python-sparkpost/pull/124) Added `delete` method to `Transmission` class
+- CI tests now also run against Python 3.5
+
+### Changed
+- [#123](https://github.com/SparkPost/python-sparkpost/pull/123) Updated RequestsTransport to use a requests session so HTTP Keep Alive is honored
+
+### Fixed
+- [#115](https://github.com/SparkPost/python-sparkpost/pull/115) Guess attachment mimetype in Django email backend if not provided
+
+## [1.2.0] - 2016-04-19
+### Added
+- [#109](https://github.com/SparkPost/python-sparkpost/pull/109) Support for specifying `template`, `substitution_data` when using the Django email backend
+- [#100](https://github.com/SparkPost/python-sparkpost/pull/100) Support for the `content_subtype` attribute when using the `EmailMessage` class in Django
+
+## [1.1.1] - 2016-04-08
+### Fixed
+- [#99](https://github.com/SparkPost/python-sparkpost/pull/99) Issue where inline images were always passed to the API, which in turn required HTML content
+
+## [1.1.0] - 2016-03-30
+### Added
+- [#94](https://github.com/SparkPost/python-sparkpost/pull/94) Better extensibility with support for Tornado
+- [#95](https://github.com/SparkPost/python-sparkpost/pull/95) Support for CSS inlining
+- [#98](https://github.com/SparkPost/python-sparkpost/pull/98) Support for inline images
+- [#98](https://github.com/SparkPost/python-sparkpost/pull/98) Support for specifying IP pool
+
+### Fixed
+- [#97](https://github.com/SparkPost/python-sparkpost/pull/97) Issue where substitution data was being improperly passed to the templates preview endpoint
+- [#91](https://github.com/SparkPost/python-sparkpost/pull/91) Issue where Django backend was not properly base64 encoding attachments
+
+## [1.0.5] - 2016-03-18
+### Fixed
+- [#89](https://github.com/SparkPost/python-sparkpost/pull/89) Issue where global Django settings object was being modified, causing mixed emails
+
+## [1.0.4] - 2016-03-10
+### Added
+- `SPARKPOST_OPTIONS` setting for Django for passing through additional transmission options like `track_opens`, `track_clicks`, and `transactional`
+- Support for cc, bcc, reply to, and attachments for Django
+
+### Changed
+- Refactored some of the bits in the Django email backend out into a `SparkPostMessage` class which prepares parameters for calls to the `Transmissions.send` method
+
+## [1.0.3] - 2016-03-03
+### Added
+- Tox for local testing
+- Allow unicode recipients
+- Automatically parse emails with friendly from e.g. `Friendly Name <hi at example.com>`
+- Support for cc/bcc
+
+## [1.0.2] - 2016-02-25
+### Added
+- Support for attachments via the `attachments` parameter in `Transmissions`
+
+## [1.0.1] - 2016-02-25
+### Fixed
+- Subpackages now get included properly
+- Updated examples to use plural `transmissions`
+
+## [1.0.0] - 2015-11-06
+### Added
+- Django email backend
+- Support for scheduled sending via the `start_time` parameter in `Transmissions`
+- Support for marking messages as transactional or non-transactional via the `transactional` parameter in `Transmissions`
+- Support for skipping suppression (SparkPost Elite only) via the `skip_suppression` parameter in `Transmissions`
+
+## [1.0.0.dev2] - 2015-09-01
+### Added
+- Code coverage via [coveralls]
+- CONTRIBUTING file for notes on how to contribute
+- `Templates` class to manage templates
+- `RecipientLists` class to manage recipients we want to send to
+- `SuppressionLists` class to manage recipients that are suppressed
+
+### Changed
+- Renamed `Transmission` class to `Transmissions` (backwards compatible)
+
+### Removed
+- Tox file for running tests in favor of `make test` and Travis CI
+
+### Fixed
+- Engagement tracking no longer automatically enabled for all transmissions
+- Documentation generation issues
+
+## 1.0.0.dev1 - 2014-02-09
+### Added
+- Base SparkPost class
+- `Transmission` class for sending messages
+- Examples for Transmission usage
+- Metrics class for getting a list of campaigns and domains
+- Docs on readthedocs.org
+
+[unreleased]: https://github.com/sparkpost/python-sparkpost/compare/v1.3.2...HEAD
+[1.3.2]: https://github.com/sparkpost/python-sparkpost/compare/v1.3.1...v1.3.2
+[1.3.1]: https://github.com/sparkpost/python-sparkpost/compare/v1.3.0...v1.3.1
+[1.3.0]: https://github.com/sparkpost/python-sparkpost/compare/v1.2.0...v1.3.0
+[1.2.0]: https://github.com/sparkpost/python-sparkpost/compare/v1.1.1...v1.2.0
+[1.1.1]: https://github.com/sparkpost/python-sparkpost/compare/v1.1.0...v1.1.1
+[1.1.0]: https://github.com/sparkpost/python-sparkpost/compare/v1.0.5...v1.1.0
+[1.0.5]: https://github.com/sparkpost/python-sparkpost/compare/v1.0.4...v1.0.5
+[1.0.4]: https://github.com/sparkpost/python-sparkpost/compare/v1.0.3...v1.0.4
+[1.0.3]: https://github.com/sparkpost/python-sparkpost/compare/v1.0.2...v1.0.3
+[1.0.2]: https://github.com/sparkpost/python-sparkpost/compare/v1.0.1...v1.0.2
+[1.0.1]: https://github.com/sparkpost/python-sparkpost/compare/v1.0.0...v1.0.1
+[1.0.0]: https://github.com/sparkpost/python-sparkpost/compare/1.0.0.dev2...v1.0.0
+[1.0.0.dev2]: https://github.com/sparkpost/python-sparkpost/compare/1.0.0.dev1...1.0.0.dev2
+[coveralls]: https://coveralls.io/github/SparkPost/python-sparkpost
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..ac46942
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,74 @@
+# Contributing to python-sparkpost
+
+Transparency is one of our core values, and we encourage developers to contribute and become part of the SparkPost developer community.
+
+The following is a set of guidelines for contributing to python-sparkpost,
+which is hosted in the [SparkPost Organization](https://github.com/sparkpost) on GitHub.
+These are just guidelines, not rules, use your best judgment and feel free to
+propose changes to this document in a pull request.
+
+## Submitting Issues
+
+* You can create an issue [here](https://github.com/sparkpost/python-sparkpost/issues/new), but
+  before doing that please read the notes below on debugging and submitting issues,
+  and include as many details as possible with your report.
+* Include the version of python-sparkpost you are using.
+* Perform a [cursory search](https://github.com/SparkPost/python-sparkpost/issues?q=is%3Aissue+is%3Aopen)
+  to see if a similar issue has already been submitted.
+
+## Local development
+
+* Fork this repository
+* Clone your fork
+* Install virtualenv: ``pip install virtualenv``
+* Run ``make install``
+* Run ``source venv/bin/activate``
+* Write code!
+
+## Contribution Steps
+
+### Guidelines
+
+- Provide documentation for any newly added code.
+- Provide tests for any newly added code.
+- Follow PEP8.
+
+1. Create a new branch named after the issue you’ll be fixing (include the issue number as the branch name, example: Issue in GH is #8 then the branch name should be ISSUE-8))
+2. Write corresponding tests and code (only what is needed to satisfy the issue and tests please)
+    * Include your tests in the 'test' directory in an appropriate test file
+    * Write code to satisfy the tests
+3. Ensure automated tests pass
+4. Submit a new Pull Request applying your feature/fix branch to the develop branch
+
+## Testing
+
+Once you are set up for local development:
+
+* Run ``make test`` to test against your current Python environment
+* Open htmlcov/index.html to view coverage information
+
+### Testing all version combinations
+
+You can also test all the supported Python and dependencies versions with tox:
+
+1. Install tox: ``pip install tox``
+2. Run tox: ``tox``
+
+If you do not have Python 2.7, 3.4, and 3.5, you can install them with pyenv:
+
+1. Install [pyenv](https://github.com/yyuu/pyenv)
+2. Install the required versions of Python:
+    1. ``pyenv install 2.7.11``
+    2. ``pyenv install 3.4.4``
+    3. ``pyenv install 3.5.1``
+3. Set the global versions: ``pyenv global 2.7.11 3.4.4 3.5.1``
+4. Run tox: ``tox``
+
+## Releasing
+
+To put python-sparkpost on PyPI
+
+* Ensure you have maintainer privileges in PyPI
+* Update your ``~/.pypirc`` if necessary to contain your username and password (hint: you can run ``python setup.py register``)
+* Run ``make release``, which will create the dists and upload them to PyPI
+* Confirm you are able to successfully install the new version by running ``pip install sparkpost``
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..866a901
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,13 @@
+Copyright 2015 Message Systems, Inc. or its affiliates. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License").
+You may not use this software except in compliance with the License.
+
+A copy of the License is located at
+
+http://www.apache.org/licenses/LICENSE-2.0.html
+
+or in the "license" file accompanying this software. This file is
+distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+ANY KIND, either express or implied. See the License for the specific
+language governing permissions and limitations under the License.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..e632e06
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1 @@
+include AUTHORS.rst README.rst LICENSE
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ac4084e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,38 @@
+.PHONY: analysis all build clean docs docs-install docs-open install release release-test test venv 
+
+all: clean venv install
+
+venv:
+	virtualenv venv
+
+install: venv
+	. venv/bin/activate; pip install -r dev-requirements.txt
+	. venv/bin/activate; pip install -e .
+
+analysis:
+	. venv/bin/activate; flake8 sparkpost test
+
+test: analysis
+	. venv/bin/activate; py.test --cov-report term-missing --cov-report html --cov sparkpost test/
+
+docs-install:
+	. venv/bin/activate; pip install -r docs/requirements.txt
+
+docs:
+	. venv/bin/activate; cd docs && make html
+
+docs-open: docs
+	. venv/bin/activate; open docs/_build/html/index.html
+
+release: install
+	. venv/bin/activate; python setup.py sdist bdist_wheel; twine upload -r pypi dist/*
+
+release-test: install
+	. venv/bin/activate; python setup.py sdist bdist_wheel; twine upload -r test dist/*
+
+build: install
+	. venv/bin/activate; python setup.py sdist
+	. venv/bin/activate; python setup.py bdist_wheel
+
+clean:
+	rm -rf venv build dist *.egg-info
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..e3d3dfd
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,141 @@
+.. image:: https://www.sparkpost.com/sites/default/files/attachments/SparkPost_Logo_2-Color_Gray-Orange_RGB.svg
+    :target: https://www.sparkpost.com
+    :width: 200px
+
+`Sign up`_ for a SparkPost account and visit our `Developer Hub`_ for even more content.
+
+.. _Sign up: https://app.sparkpost.com/sign-up?src=Dev-Website&sfdcid=70160000000pqBb
+.. _Developer Hub: https://developers.sparkpost.com
+
+SparkPost Python API client
+===========================
+
+.. image:: https://travis-ci.org/SparkPost/python-sparkpost.svg?branch=master
+    :target: https://travis-ci.org/SparkPost/python-sparkpost
+    :alt: Build Status
+
+.. image:: https://readthedocs.org/projects/python-sparkpost/badge/?version=latest
+    :target: https://python-sparkpost.readthedocs.io/en/latest/
+    :alt: Documentation Status
+
+.. image:: https://coveralls.io/repos/SparkPost/python-sparkpost/badge.svg?branch=master&service=github
+    :target: https://coveralls.io/github/SparkPost/python-sparkpost?branch=master
+    :alt: Coverage Status
+
+.. image:: http://slack.sparkpost.com/badge.svg
+    :target: http://slack.sparkpost.com
+    :alt: Slack Community
+
+The super-mega-official Python package for using the SparkPost API.
+
+
+Installation
+------------
+
+Install from PyPI using `pip`_:
+
+.. code-block:: bash
+
+    $ pip install sparkpost
+
+.. _pip: http://www.pip-installer.org/en/latest/
+
+.. _pip: http://www.pip-installer.org/en/latest/
+
+
+Get a key
+---------
+
+Go to `API & SMTP`_ in the SparkPost app and create an API key. We recommend using the ``SPARKPOST_API_KEY`` environment variable:
+
+.. code-block:: python
+
+    from sparkpost import SparkPost
+    sp = SparkPost() # uses environment variable
+
+Alternatively, you can pass the API key to the SparkPost class:
+
+.. code-block:: python
+
+    from sparkpost import SparkPost
+    sp = SparkPost('YOUR API KEY')
+
+.. _API & SMTP: https://app.sparkpost.com/#/configuration/credentials
+
+
+Send a message
+--------------
+
+Here at SparkPost, our messages are known as transmissions. Let's use the underlying `transmissions API`_ to send a friendly test message:
+
+.. code-block:: python
+
+    from sparkpost import SparkPost
+
+    sp = SparkPost()
+
+    response = sp.transmissions.send(
+        recipients=['someone at somedomain.com'],
+        html='<p>Hello world</p>',
+        from_email='test at sparkpostbox.com',
+        subject='Hello from python-sparkpost'
+    )
+
+    print(response)
+    # outputs {u'total_accepted_recipients': 1, u'id': u'47960765679942446', u'total_rejected_recipients': 0}
+
+.. _transmissions API: https://www.sparkpost.com/api#/reference/transmissions
+
+Django Integration
+------------------
+The SparkPost python library comes with an email backend for Django. Put the following configuration in `settings.py` file.
+
+.. code-block:: python
+
+    SPARKPOST_API_KEY = 'API_KEY'
+    EMAIL_BACKEND = 'sparkpost.django.email_backend.SparkPostEmailBackend'
+
+Replace *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.
+
+.. _full documentation: https://python-sparkpost.readthedocs.io/en/latest/django/backend.html
+
+Using with Google Cloud
+-----------------------
+There 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``:
+
+.. code-block::
+
+    requests
+    requests-toolbelt
+
+Then create or update your ``appengine_config.py`` file to include the following:
+
+.. code-block:: python
+
+    import requests
+    import requests_toolbelt.adapters.appengine
+    
+    requests_toolbelt.adapters.appengine.monkeypatch()
+
+Then deploy your app and you should be able to send using python-sparkpost on Google Cloud.
+
+Documentation
+-------------
+
+* Documentation for `python-sparkpost`_
+* `SparkPost API Reference`_
+
+.. _python-sparkpost: https://python-sparkpost.readthedocs.io/
+.. _SparkPost API Reference: https://www.sparkpost.com/api
+
+
+Contribute
+----------
+
+#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
+#. Fork `the repository`_ on GitHub and make your changes in a branch on your fork
+#. Write a test which shows that the bug was fixed or that the feature works as expected.
+#. Send a pull request. Make sure to add yourself to AUTHORS_.
+
+.. _`the repository`: http://github.com/SparkPost/python-sparkpost
+.. _AUTHORS: https://github.com/SparkPost/python-sparkpost/blob/master/AUTHORS.rst
diff --git a/dev-requirements.txt b/dev-requirements.txt
new file mode 100644
index 0000000..7187845
--- /dev/null
+++ b/dev-requirements.txt
@@ -0,0 +1,5 @@
+-r test-requirements.txt
+wheel
+twine
+Django>=1.7,<1.10
+tornado>=3.2
\ No newline at end of file
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 0000000..750c809
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,177 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  texinfo    to make Texinfo files"
+	@echo "  info       to make Texinfo files and run them through makeinfo"
+	@echo "  gettext    to make PO message catalogs"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  xml        to make Docutils-native XML files"
+	@echo "  pseudoxml  to make pseudoxml-XML files for display purposes"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/python-sparkpost.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/python-sparkpost.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/python-sparkpost"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/python-sparkpost"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+latexpdfja:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through platex and dvipdfmx..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo
+	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+	@echo "Run \`make' in that directory to run these through makeinfo" \
+	      "(use \`make info' here to do that automatically)."
+
+info:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo "Running Texinfo files through makeinfo..."
+	make -C $(BUILDDIR)/texinfo info
+	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+	@echo
+	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."
+
+xml:
+	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+	@echo
+	@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+pseudoxml:
+	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+	@echo
+	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/docs/api.rst b/docs/api.rst
new file mode 100644
index 0000000..7a89b30
--- /dev/null
+++ b/docs/api.rst
@@ -0,0 +1,11 @@
+=================
+API Documentation
+=================
+
+A complete API reference to the :data:`sparkpost` module.
+
+.. toctree::
+   :glob:
+   :maxdepth: 1
+
+   api/*
diff --git a/docs/api/recipient_lists.rst b/docs/api/recipient_lists.rst
new file mode 100644
index 0000000..d724576
--- /dev/null
+++ b/docs/api/recipient_lists.rst
@@ -0,0 +1,7 @@
+.. module:: sparkpost.recipient_lists
+
+:mod:`sparkpost.recipient_lists`
+================================
+
+.. autoclass:: RecipientLists
+   :members:
diff --git a/docs/api/suppression_list.rst b/docs/api/suppression_list.rst
new file mode 100644
index 0000000..ce86428
--- /dev/null
+++ b/docs/api/suppression_list.rst
@@ -0,0 +1,7 @@
+.. module:: sparkpost.suppression_list
+
+:mod:`sparkpost.suppression_list`
+=================================
+
+.. autoclass:: SuppressionList
+   :members:
diff --git a/docs/api/templates.rst b/docs/api/templates.rst
new file mode 100644
index 0000000..cfa8ba8
--- /dev/null
+++ b/docs/api/templates.rst
@@ -0,0 +1,7 @@
+.. module:: sparkpost.templates
+
+:mod:`sparkpost.templates`
+=============================
+
+.. autoclass:: Templates
+   :members:
diff --git a/docs/api/transmissions.rst b/docs/api/transmissions.rst
new file mode 100644
index 0000000..5ab81c8
--- /dev/null
+++ b/docs/api/transmissions.rst
@@ -0,0 +1,7 @@
+.. module:: sparkpost.transmissions
+
+:mod:`sparkpost.transmissions`
+==============================
+
+.. autoclass:: Transmissions
+   :members:
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644
index 0000000..1b925e7
--- /dev/null
+++ b/docs/conf.py
@@ -0,0 +1,271 @@
+# -*- coding: utf-8 -*-
+#
+# python-sparkpost documentation build configuration file, created by
+# sphinx-quickstart on Sun Feb  1 21:26:22 2015.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import datetime
+import sys
+import os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.insert(0, os.path.abspath('.'))
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+    'sphinx.ext.autodoc',
+]
+
+# Load the source for autodoc
+sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), '..')))
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
... 4801 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-sparkpost.git



More information about the Python-modules-commits mailing list