Skip to content

Commit 2d76aba

Browse files
author
marcel corso gonzalez
authored
Merge pull request #62 from mehmetminanc/drop-python2-support
Drop python2 support
2 parents c4decdb + 3f5aec2 commit 2d76aba

27 files changed

Lines changed: 70 additions & 176 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ target/
5959

6060
# PyCharm
6161
.idea/
62+
*.iml
6263

6364
# pyvenv
64-
venv/
65+
venv*/

.travis.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
language: python
22
python:
3-
- 'pypy2.7'
4-
- 'pypy3.5'
5-
- '2.7'
6-
- '3.4'
3+
- 'pypy3.6'
4+
- 'pypy3.7'
75
- '3.6'
6+
- '3.7'
7+
- '3.8'
8+
- '3.9'
89
- 'nightly'
910
install:
10-
- pip install mock==2.0
11-
- pip install requests
12-
- pip install codecov
13-
- pip install pytest pytest-cov
14-
- pip install pycodestyle
15-
- pip install .
11+
- pip install -e .[dev]
1612
script:
1713
- coverage run --source=messagebird -m unittest discover -s tests/
1814
- coverage report --fail-under=80
@@ -21,5 +17,3 @@ script:
2117
matrix:
2218
allow_failures:
2319
- python: 'nightly'
24-
- python: 'pypy2.7'
25-
- python: 'pypy3.5'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import messagebird
3535
Then, create an instance of **messagebird.Client**:
3636

3737
```python
38-
client = messagebird.Client('test_gshuPaZoeEG6ovbc8M79w0QyM')
38+
client = messagebird.Client('YOUR_ACCESS_KEY')
3939
```
4040

4141
Now you can query the API for information or send a request. For example, if we want to request our balance information you'd do something like this:

messagebird/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import json
55

66

7-
class Base(object):
7+
class Base:
88
def load(self, data):
99
if data is not None:
1010
for name, value in list(data.items()):

messagebird/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from messagebird.number import Number, NumberList
2626

2727
ENDPOINT = 'https://rest.messagebird.com'
28-
CLIENT_VERSION = '1.6.0'
28+
CLIENT_VERSION = '2.0.0'
2929
PYTHON_VERSION = '%d.%d.%d' % (sys.version_info[0], sys.version_info[1], sys.version_info[2])
3030
USER_AGENT = 'MessageBird/ApiClient/%s Python/%s' % (CLIENT_VERSION, PYTHON_VERSION)
3131
REST_TYPE = 'rest'
@@ -62,6 +62,7 @@ def __init__(self, errorMessage):
6262
super(SignleErrorException, self).__init__(errorMessage)
6363

6464

65+
6566
class Client(object):
6667
def __init__(self, access_key, http_client=None):
6768
self.access_key = access_key

messagebird/http_client.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,15 @@
33

44
from messagebird.serde import json_serialize
55

6-
try:
7-
from urllib.parse import urljoin
8-
except ImportError:
9-
from urlparse import urljoin
6+
from urllib.parse import urljoin
107

118

129
class ResponseFormat(Enum):
1310
text = 1
1411
binary = 2
1512

1613

17-
class HttpClient(object):
14+
class HttpClient:
1815
"""Used for sending simple HTTP requests."""
1916

2017
def __init__(self, endpoint, access_key, user_agent):

messagebird/signed_request.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
import time
55
from collections import OrderedDict
66

7-
try:
8-
from urllib.parse import urlencode
9-
except ImportError:
10-
from urllib import urlencode
7+
from urllib.parse import urlencode
118

129

1310
class SignedRequest:

setup.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,38 @@
22
from setuptools import setup
33
from io import open
44

5-
def get_description():
6-
working_directory = path.abspath(path.dirname(__file__))
7-
readme_path = path.join(working_directory, 'README.md')
8-
with open(readme_path, encoding='utf-8') as f:
9-
return (f.read(), 'text/markdown')
10-
11-
description, description_content_type = get_description()
5+
with open('README.md', encoding='utf-8') as f:
6+
description = f.read()
127

138
setup(
149
name = 'messagebird',
1510
packages = ['messagebird'],
16-
version = '1.6.0',
11+
version = '2.0.0',
1712
description = "MessageBird's REST API",
1813
author = 'MessageBird',
1914
author_email = 'support@messagebird.com',
2015
long_description = description,
21-
long_description_content_type = description_content_type,
16+
long_description_content_type = 'text/markdown',
2217
url = 'https://github.com/messagebird/python-rest-api',
23-
download_url = 'https://github.com/messagebird/python-rest-api/tarball/1.6.0',
18+
download_url = 'https://github.com/messagebird/python-rest-api/tarball/2.0.0',
2419
keywords = ['messagebird', 'sms'],
2520
install_requires = ['requests>=2.4.1', 'python-dateutil>=2.6.0'],
21+
extras_require = {
22+
'dev': [
23+
'pytest',
24+
'pytest-cov',
25+
'mock>=2.0',
26+
'codecov',
27+
'pycodestyle',
28+
]
29+
},
2630
license = 'BSD-2-Clause',
2731
classifiers = [
28-
'Programming Language :: Python',
29-
'Programming Language :: Python :: 2',
3032
'Programming Language :: Python :: 3',
33+
'Programming Language :: Python :: 3.6',
34+
'Programming Language :: Python :: 3.7',
35+
'Programming Language :: Python :: 3.8',
36+
'Programming Language :: Python :: 3.9',
37+
'Operating System :: OS Independent',
3138
],
3239
)

tests/test_balance.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import unittest
2-
from messagebird import Client
2+
from unittest.mock import Mock
33

4-
try:
5-
from unittest.mock import Mock
6-
except ImportError:
7-
# mock was added to unittest in Python 3.3, but was an external library
8-
# before.
9-
from mock import Mock
4+
from messagebird import Client
105

116

127
class TestBalance(unittest.TestCase):

tests/test_call.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
import json
22
import unittest
3-
from messagebird import Client, ErrorException
3+
from unittest.mock import Mock
4+
5+
from messagebird import Client
46
from messagebird.base import Base
5-
from messagebird.client import VOICE_TYPE
6-
7-
try:
8-
from unittest.mock import Mock
9-
except ImportError:
10-
# mock was added to unittest in Python 3.3, but was an external library
11-
# before.
12-
from mock import Mock
137

148

159
class TestCall(unittest.TestCase):

0 commit comments

Comments
 (0)