Skip to content

Commit 6a85132

Browse files
committed
error handling of bad post requests
1 parent 9155650 commit 6a85132

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
setup(name="staffjoy",
44
packages=find_packages(),
5-
version="0.7",
5+
version="0.8",
66
description="Staffjoy API Wrapper in Python",
77
author="Philip Thomas",
88
author_email="help@staffjoy.com",
99
license="MIT",
1010
url="https://github.com/staffjoy/client_python",
11-
download_url="https://github.com/StaffJoy/client_python/archive/0.7.tar.gz",
11+
download_url="https://github.com/StaffJoy/client_python/archive/0.8.tar.gz",
1212
keywords=["staffjoy-api", "staffjoy", "staff joy"],
1313
install_requires=["requests[security]"], )

staffjoy/resource.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ def create(cls, parent=None, **kwargs):
164164

165165
response = requests.post(obj._url(), auth=(obj.key, ""), data=kwargs)
166166

167+
if response.status_code not in cls.TRUTHY_CODES:
168+
return base_obj._handle_request_exception(response)
169+
167170
# No envelope on post requests
168171
data = response.json()
169172
obj.route[obj.ID_NAME] = data.get("id")

0 commit comments

Comments
 (0)