Skip to content
This repository was archived by the owner on Sep 6, 2025. It is now read-only.

Commit 1fef975

Browse files
authored
Merge pull request #5 from hellofresh/major/python-3-support
Add python 3 support
2 parents 1ff73f7 + dddc956 commit 1fef975

File tree

5 files changed

+58
-13
lines changed

5 files changed

+58
-13
lines changed

appboy/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ def __create_request(self, payload, request_type):
102102

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

110110
if 'success' not in response:
111111
response['success'] = False

examples.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
)
1818
if r['success']:
1919
# do our magic here
20-
print 'Success!'
21-
print r
20+
print('Success!')
21+
print(r)
2222
else:
23-
print r['client_error']
24-
print r['errors']
23+
print(r['client_error'])
24+
print(r['errors'])
2525

2626
# For delete users by external_id or appboy_id
2727
r = client.user_delete(
@@ -30,8 +30,8 @@
3030
)
3131
if r['success']:
3232
# do our magic here
33-
print 'Success!'
34-
print r
33+
print('Success!')
34+
print(r)
3535
else:
36-
print r['client_error']
37-
print r['errors']
36+
print(r['client_error'])
37+
print(r['errors'])

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
NAME = "appboy-client"
44
VERSION = "0.0.1"
55

6-
REQUIRES = []
6+
REQUIRES = [
7+
'requests==2.21.0',
8+
]
9+
10+
EXTRAS = {
11+
'dev': [
12+
'tox',
13+
],
14+
}
715

816
setup(
917
name=NAME,
@@ -12,5 +20,11 @@
1220
author_email="azh@hellofresh.com",
1321
keywords=["HelloFresh", "Appboy"],
1422
install_requires=REQUIRES,
15-
packages=find_packages()
23+
extras_require=EXTRAS,
24+
packages=find_packages(exclude=('tests',)),
25+
classifiers=[
26+
'Programming Language :: Python',
27+
'Programming Language :: Python :: 2.7',
28+
'Programming Language :: Python :: 3.7',
29+
],
1630
)

tox.ini

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[tox]
2+
envlist = style, unit-27, unit-37
3+
4+
# Configs
5+
[pytest]
6+
addopts = -p no:warnings
7+
8+
# Local Unit
9+
[testenv:unit]
10+
deps =
11+
codecov
12+
mock
13+
pytest
14+
pytest-cov
15+
pytest-mock
16+
commands =
17+
pytest tests
18+
19+
[testenv:unit-27]
20+
basepython = python2.7
21+
deps = {[testenv:unit]deps}
22+
commands = {[testenv:unit]commands}
23+
24+
[testenv:unit-37]
25+
basepython = python3.7
26+
deps = {[testenv:unit]deps}
27+
commands = {[testenv:unit]commands}
28+
29+
# Codestyle
30+
[testenv:style]
31+
deps = flake8
32+
commands = flake8 --max-line-length=120 appboy

0 commit comments

Comments
 (0)