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
58 changes: 58 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/
2 changes: 0 additions & 2 deletions messagebird/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ def load(self, data):
for name, value in data.items():
if hasattr(self, name):
setattr(self, name, value)
else:
raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, name))

return self

Expand Down
8 changes: 5 additions & 3 deletions messagebird/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import json
import requests

try:
Expand All @@ -14,7 +15,7 @@
from messagebird.voicemessage import VoiceMessage

ENDPOINT = 'https://rest.messagebird.com'
CLIENT_VERSION = '1.0.0'
CLIENT_VERSION = '1.0.1'
PYTHON_VERSION = '%d.%d.%d' % (sys.version_info[0], sys.version_info[1], sys.version_info[2])

class ErrorException(BaseException):
Expand All @@ -32,13 +33,14 @@ def request(self, path, params={}):
headers = {
'Accept' : 'application/json',
'Authorization' : 'AccessKey ' + self.access_key,
'User-Agent' : 'MessageBird/ApiClient/%s Python/%s' % (CLIENT_VERSION, PYTHON_VERSION)
'User-Agent' : 'MessageBird/ApiClient/%s Python/%s' % (CLIENT_VERSION, PYTHON_VERSION),
'Content-Type' : 'application/json'
}

if len(params) == 0:
response = requests.get(url, verify=True, headers=headers)
else:
response = requests.post(url, verify=True, headers=headers, data=params)
response = requests.post(url, verify=True, headers=headers, data=json.dumps(params))

if response.status_code in self._supported_status_codes:
json_response = response.json()
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
setup(
name = 'messagebird',
packages = ['messagebird'],
version = '1.0.0',
version = '1.0.1',
description = "MessageBird's REST API",
author = 'Maurice Nonnekes',
author_email = 'maurice@messagebird.com',
author = 'MessageBird',
author_email = 'support@messagebird.com',
url = 'https://github.com/messagebird/python-rest-api',
install_requires = ['requests>=2.4.1'],
license = 'BSD-2-Clause',
Expand Down