Skip to content

Commit

Permalink
Version Bump v3.2.1: pep8, PyPi fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkingserious committed Aug 17, 2016
1 parent 658f6ca commit 45f9c93
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log
All notable changes to this project will be documented in this file.
## [3.2.1] - 2016-08-17 ##
### Fixed
- pep8 formatting
- include Heroku config files in PyPi

## [3.2.0] - 2016-08-17 ##
### Added
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
include README.rst
include LICENSE.txt
include app.json
include Procfile
include requirements.txt
recursive-exclude test *
11 changes: 7 additions & 4 deletions sendgrid/helpers/inbound/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
app = Flask(__name__)
config = Config()

@app.route ('/', methods =['GET'])

@app.route('/', methods=['GET'])
def index():
return render_template('index.html')

@app.route (config.endpoint, methods =['POST'])

@app.route(config.endpoint, methods=['POST'])
def inbound_parse():
parse = Parse(config, request)
# Sample proccessing action
Expand All @@ -30,9 +32,10 @@ def inbound_parse():
# Everything is 200 OK :)
return "OK"

if __name__=='__main__':

if __name__ == '__main__':
# Be sure to set config.debug_mode to False in production
port = int(os.environ.get("PORT", config.port))
if port != config.port:
config.debug = False
app.run(host = '0.0.0.0', debug=config.debug_mode, port=port)
app.run(host='0.0.0.0', debug=config.debug_mode, port=port)
1 change: 1 addition & 0 deletions sendgrid/helpers/inbound/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import yaml


class Config(object):
"""All configuration for this app is loaded here"""
def __init__(self):
Expand Down
8 changes: 5 additions & 3 deletions sendgrid/helpers/inbound/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import mimetypes
from werkzeug.utils import secure_filename


class Parse(object):
def __init__(self, config, request):
self._keys = config.keys
Expand All @@ -12,7 +13,8 @@ def __init__(self, config, request):
self._payload = request.form
self._raw_payload = request.data

"""Return a dictionary of key/values in the payload received from the webhook"""
"""Return a dictionary of key/values in the payload received from
the webhook"""
def key_values(self):
key_values = {}
for key in self.keys:
Expand Down Expand Up @@ -49,7 +51,7 @@ def attachments(self):
# Check if we have a raw message
attachments = []
raw_email = self.get_raw_email()
if raw_email != None:
if raw_email is not None:
counter = 1
for part in raw_email.walk():
attachment = {}
Expand Down Expand Up @@ -83,4 +85,4 @@ def payload(self):

@property
def raw_payload(self):
return self._raw_payload
return self._raw_payload
12 changes: 9 additions & 3 deletions sendgrid/helpers/inbound/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from sendgrid.helpers.inbound.config import Config
from python_http_client import Client


class Send(object):
def __init__(self, url):
self._url = url
Expand All @@ -30,11 +31,16 @@ def url(self):

config = Config()
parser = argparse.ArgumentParser(description='Test data and optional host.')
parser.add_argument('data', type=str, help='path to the sample data')
parser.add_argument('-host', type=str, help='name of host to send the sample data to', default=config.host, required=False)
parser.add_argument('data',
type=str,
help='path to the sample data')
parser.add_argument('-host',
type=str,
help='name of host to send the sample data to',
default=config.host, required=False)
args = parser.parse_args()
send = Send(args.host)
response = send.test_payload(sys.argv[1])
print(response.status_code)
print(response.headers)
print(response.body)
print(response.body)
2 changes: 1 addition & 1 deletion sendgrid/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version_info = (3, 2, 0)
version_info = (3, 2, 1)
__version__ = '.'.join(str(v) for v in version_info)

0 comments on commit 45f9c93

Please sign in to comment.