Skip to content
This repository has been archived by the owner on Jul 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #5 from hellofresh/major/python-3-support
Browse files Browse the repository at this point in the history
Add python 3 support
  • Loading branch information
anvth committed Dec 19, 2018
2 parents 1ff73f7 + dddc956 commit 1fef975
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 13 deletions.
4 changes: 2 additions & 2 deletions appboy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ def __create_request(self, payload, request_type):

except RequestException as e:
# handle all requests HTTP exceptions
response = {'client_error': e.message}
response = {'client_error': str(e)}
except Exception as e:
# handle all exceptions which can be on API side
response = {'client_error': (e.message + '. Response: ' + r.text)}
response = {'client_error': (str(e) + '. Response: ' + r.text)}

if 'success' not in response:
response['success'] = False
Expand Down
16 changes: 8 additions & 8 deletions examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
)
if r['success']:
# do our magic here
print 'Success!'
print r
print('Success!')
print(r)
else:
print r['client_error']
print r['errors']
print(r['client_error'])
print(r['errors'])

# For delete users by external_id or appboy_id
r = client.user_delete(
Expand All @@ -30,8 +30,8 @@
)
if r['success']:
# do our magic here
print 'Success!'
print r
print('Success!')
print(r)
else:
print r['client_error']
print r['errors']
print(r['client_error'])
print(r['errors'])
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

18 changes: 16 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
NAME = "appboy-client"
VERSION = "0.0.1"

REQUIRES = []
REQUIRES = [
'requests==2.21.0',
]

EXTRAS = {
'dev': [
'tox',
],
}

setup(
name=NAME,
Expand All @@ -12,5 +20,11 @@
author_email="azh@hellofresh.com",
keywords=["HelloFresh", "Appboy"],
install_requires=REQUIRES,
packages=find_packages()
extras_require=EXTRAS,
packages=find_packages(exclude=('tests',)),
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.7',
],
)
32 changes: 32 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[tox]
envlist = style, unit-27, unit-37

# Configs
[pytest]
addopts = -p no:warnings

# Local Unit
[testenv:unit]
deps =
codecov
mock
pytest
pytest-cov
pytest-mock
commands =
pytest tests

[testenv:unit-27]
basepython = python2.7
deps = {[testenv:unit]deps}
commands = {[testenv:unit]commands}

[testenv:unit-37]
basepython = python3.7
deps = {[testenv:unit]deps}
commands = {[testenv:unit]commands}

# Codestyle
[testenv:style]
deps = flake8
commands = flake8 --max-line-length=120 appboy

0 comments on commit 1fef975

Please sign in to comment.