Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

JSON decoding bugfix and other small improvements #5

Merged
merged 3 commits into from
Nov 12, 2015

Conversation

russelldavies
Copy link
Contributor

Sometimes the Aftership API can send an erroneous response which causes a ValueError to be thrown. It's preferable for clients to only have to catch an aftership.APIRequestException.

Other changes are small tweaks that makes the SDK a bit more useful.

fedor added a commit that referenced this pull request Nov 12, 2015
JSON decoding bugfix and other small improvements
@fedor fedor merged commit 3680c94 into AfterShip:master Nov 12, 2015
@fedor
Copy link
Contributor

fedor commented Nov 12, 2015

@russelldavies thanks, merged

@fedor
Copy link
Contributor

fedor commented Nov 12, 2015

@russelldavies I'd like to follow up.

After merge I've reviewed the logic again and found it breaks parsing of errors returned by API (e.g. invalid API key). So I've changed it again (keeping correct handling of JSON decode fails).

Also your changes to APIRequestException ensures that error object interfaces would work if input is either error object (dict) or string. However it doesn't cover the case if object with unexpected format is passed. So I've changed this part also.

Code: https://github.com/AfterShip/aftership-python/blob/master/aftership/__init__.py
Update published to PyPI: https://pypi.python.org/pypi/aftership/0.2

Thanks again!

@russelldavies
Copy link
Contributor Author

@korshunov Great, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants