Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ bin/
include/
lib/
.env
smtpapi/VERSION.txt
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: python
python:
- '2.6'
- '2.7'
- '3.4'
- '3.5'
- '2.6'
- '2.7'
- '3.4'
- '3.5'
install:
- python setup.py install
- pip install codecov
Expand Down
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
include README.md
include README.rst LICENSE.txt VERSION.txt
recursive-include smtpapi *.py *.txt
prune test
111 changes: 0 additions & 111 deletions README.md

This file was deleted.

149 changes: 149 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
.. image:: https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png
:target: https://www.sendgrid.com
:alt: SendGrid Logo

|Travis Badge| |Email Notifications Badge| |Twitter Follow| |Codecov branch| |Python Versions| |PyPI Version| |GitHub contributors| |MIT Licensed|

**This module helps build SendGrid's SMTP API headers.**

Learn more about the SMTP API at `SendGrid documentation`_.

Announcements
=============

All updates to this module is documented in our `CHANGELOG`_.

Table of Contents
=================

- `Installation <#installation>`__
- `Quick Start <#quick-start>`__
- `Usage <#usage>`__
- `Roadmap <#roadmap>`__
- `How to Contribute <#how-to-contribute>`__
- `Local Setup of the Project <#local-setup-of-the-project>`__
- `About <#about>`__
- `License <#license>`__

Installation
============

Prerequisites
-------------

- Python version 2.6, 2.7, 3.4 or 3.5
- The SendGrid service, starting at the `free level`_

Install Package
---------------

.. code:: bash

pip install smtpapi

Setup Environment Variables
---------------------------

Update the development environment with your `SENDGRID_API_KEY`_, for example:

.. code:: bash

cp .env_sample .env

In ``.env`` set ``SENDGRID_API_KEY`` to your own API key.

You can add your environment variables to your environment by sourcing the file:

.. code:: bash

source .env

Quick Start
===========

.. code:: python

from smtpapi import SMTPAPIHeader

header = SMTPAPIHeader()
header.add_to('email@email.com')
print(header.json_string())

Usage
=====

- `SendGrid documentation`_
- `Example Code`_

Roadmap
=======

If you are interested in the future direction of this project, please take a look at our `milestones`_.
We would love to hear your feedback.

How to Contribute
=================

We encourage contribution to our projects, please see our `CONTRIBUTING`_ guide for details.

Quick links:

- `Feature Request`_
- `Bug Reports`_
- `Sign the CLA to Create a Pull Request`_
- `Improvements to the Codebase`_

Local Setup of the Project
==========================

The simplest local development workflow is by using docker.

Steps:

1. Install Docker
2. Run ``docker-compose build`` (this builds the container)
3. Run ``docker-compose up`` (this runs tests by default)

About
=====

**smtpapi-python** is guided and supported by the SendGrid `Developer Experience Team`_.

**smtpapi-python** is maintained and funded by SendGrid, Inc.
The names and logos for **smtpapi-python** are trademarks of SendGrid, Inc.

License
=======

`The MIT License (MIT)`_

.. _SendGrid documentation: https://sendgrid.com/docs/API_Reference/SMTP_API/index.html
.. _CHANGELOG: https://github.com/sendgrid/smtpapi-python/blob/master/CHANGELOG.md
.. _free level: https://sendgrid.com/free?source=sendgrid-python
.. _SENDGRID_API_KEY: https://app.sendgrid.com/settings/api_keys
.. _Example Code: https://github.com/sendgrid/smtpapi-python/tree/master/examples
.. _milestones: https://github.com/sendgrid/smtpapi-python/milestones
.. _CONTRIBUTING: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md
.. _Feature Request: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md#feature-request
.. _Bug Reports: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md#submit-a-bug-report
.. _Sign the CLA to Create a Pull Request: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md#cla
.. _Improvements to the Codebase: https://github.com/sendgrid/smtpapi-python/blob/master/CONTRIBUTING.md#improvements-to-the-codebase
.. _Developer Experience Team: mailto:dx@sendgrid.com
.. _The MIT License (MIT): https://github.com/sendgrid/smtpapi-python/blob/master/LICENSE.txt

.. |Travis Badge| image:: https://travis-ci.org/sendgrid/smtpapi-python.svg?branch=master
:target: https://travis-ci.org/sendgrid/smtpapi-python
.. |Email Notifications Badge| image:: https://dx.sendgrid.com/badge/python
:target: https://dx.sendgrid.com/newsletter/python
.. |Twitter Follow| image:: https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow
:target: https://twitter.com/sendgrid
.. |Codecov branch| image:: https://img.shields.io/codecov/c/github/sendgrid/smtpapi-python/master.svg?style=flat-square&label=Codecov+Coverage
:target: https://codecov.io/gh/sendgrid/smtpapi-python
.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/smtpapi.svg
:target: https://pypi.org/project/smtpapi/
.. |PyPI Version| image:: https://img.shields.io/pypi/v/smtpapi.svg
:target: https://pypi.org/project/smtpapi/
.. |GitHub contributors| image:: https://img.shields.io/github/contributors/sendgrid/smtpapi-python.svg
:target: https://github.com/sendgrid/smtpapi-python/graphs/contributors
.. |MIT Licensed| image:: https://img.shields.io/badge/license-MIT-blue.svg
:target: https://github.com/sendgrid/smtpapi-python/blob/master/LICENSE.txt
1 change: 1 addition & 0 deletions VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.3.1
24 changes: 21 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
import io
import os
from distutils.file_util import copy_file
from setuptools import setup, find_packages


dir_path = os.path.abspath(os.path.dirname(__file__))
readme = io.open(os.path.join(dir_path, 'README.rst'), encoding='utf-8').read()
version = io.open(os.path.join(dir_path, 'VERSION.txt'), encoding='utf-8').read().strip()
copy_file(os.path.join(dir_path, 'VERSION.txt'),
os.path.join(dir_path, 'smtpapi', 'VERSION.txt'),
verbose=0)
setup(
name='smtpapi',
version='0.3.1',
version=version,
author='Yamil Asusta, Kane Kim',
author_email='yamil@sendgrid.com, kane.isturm@sendgrid.com',
packages=find_packages(),
url='https://github.com/sendgrid/smtpapi-python/',
packages=find_packages(exclude=["test"]),
include_package_data=True,
license='MIT License',
description='Simple wrapper to use SendGrid SMTP API',
long_description='Simple wrapper to use SendGrid SMTP API',
long_description=readme,
classifiers=[
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],
)
9 changes: 8 additions & 1 deletion smtpapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import json, decimal
import decimal
import json
import os


dir_path = os.path.dirname(os.path.realpath(__file__))
if os.path.isfile(os.path.join(dir_path, 'VERSION.txt')):
__version__ = open(os.path.join(dir_path, 'VERSION.txt')).read().strip()

class _CustomJSONEncoder(json.JSONEncoder):

Expand Down
4 changes: 2 additions & 2 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ def setUp(self):
'./CODE_OF_CONDUCT.md',
'./CONTRIBUTING.md',
['./LICENSE.md', './LICENSE.txt'],
'./README.md',
'./README.rst',
'./TROUBLESHOOTING.md',
'./USAGE.md',
'./USE_CASES.md',
'./VERSION.txt',
]

self.file_not_found_message = 'File "{0}" does not exist in repo!'
Expand Down
10 changes: 5 additions & 5 deletions test/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def test_license(self):
def test_pr_template(self):
self.assertEqual(True, os.path.isfile('./.github/PULL_REQUEST_TEMPLATE'))

# ./README.md
# ./README.rst
def test_readme(self):
self.assertEqual(True, os.path.isfile('./README.md'))
self.assertEqual(True, os.path.isfile('./README.rst'))

# ./TROUBLESHOOTING.md
def test_troubleshooting(self):
Expand All @@ -67,9 +67,9 @@ def test_troubleshooting(self):
def test_usage(self):
self.assertEqual(True, os.path.isfile('./USAGE.md'))

# ./USE_CASES.md
# ./VERSION.txt
def test_use_cases(self):
self.assertEqual(True, os.path.isfile('./USE_CASES.md'))
self.assertEqual(True, os.path.isfile('./VERSION.txt'))

if __name__ == '__main__':
unittest.main()
unittest.main()