diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0740712 --- /dev/null +++ b/.gitignore @@ -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/ diff --git a/messagebird/base.py b/messagebird/base.py index 55792ca..24a5e69 100644 --- a/messagebird/base.py +++ b/messagebird/base.py @@ -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 diff --git a/messagebird/client.py b/messagebird/client.py index a1a8667..cbfec70 100644 --- a/messagebird/client.py +++ b/messagebird/client.py @@ -1,4 +1,5 @@ import sys +import json import requests try: @@ -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): @@ -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() diff --git a/setup.py b/setup.py index 89ff0a4..0c6f6e3 100644 --- a/setup.py +++ b/setup.py @@ -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',