Skip to content

Commit

Permalink
fix #167
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesthk committed Jun 13, 2018
1 parent dc46509 commit 3377ea9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![mailchimp3 v3.0.3 on PyPi](https://img.shields.io/pypi/v/mailchimp3.svg)](https://pypi.python.org/pypi/mailchimp3)
[![mailchimp3 v3.0.4 on PyPi](https://img.shields.io/pypi/v/mailchimp3.svg)](https://pypi.python.org/pypi/mailchimp3)
![MIT license](https://img.shields.io/badge/licence-MIT-blue.svg)
![Stable](https://img.shields.io/badge/status-stable-green.svg)

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
|mailchimp3 v3.0.3 on PyPi| |MIT license| |Stable|
|mailchimp3 v3.0.4 on PyPi| |MIT license| |Stable|

python-mailchimp-api
====================
Expand Down Expand Up @@ -915,7 +915,7 @@ License

The project is licensed under the MIT License.

.. |mailchimp3 v3.0.3 on PyPi| image:: https://img.shields.io/pypi/v/mailchimp3.svg
.. |mailchimp3 v3.0.4 on PyPi| image:: https://img.shields.io/pypi/v/mailchimp3.svg
:target: https://pypi.python.org/pypi/mailchimp3
.. |MIT license| image:: https://img.shields.io/badge/licence-MIT-blue.svg
.. |Stable| image:: https://img.shields.io/badge/status-stable-green.svg
Expand Down
8 changes: 7 additions & 1 deletion mailchimp3/mailchimpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import functools
import re


import requests
from requests.auth import HTTPBasicAuth
# Handle library reorganisation Python 2 > Python 3.
Expand Down Expand Up @@ -122,7 +123,12 @@ def _post(self, url, data=None):
raise e
else:
if r.status_code >= 400:
raise MailChimpError(r.json())
# in case of a 500 error, the response might not be a JSON
try:
error_data = r.json()
except ValueError:
error_data = { "response": r }
raise MailChimpError(error_data)
if r.status_code == 204:
return None
return r.json()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name='mailchimp3',
version='3.0.3',
version='3.0.4',
description='A python client for v3 of MailChimp API',
long_description=long_description,
url='https://github.com/charlesthk/python-mailchimp',
Expand Down

0 comments on commit 3377ea9

Please sign in to comment.