Skip to content

Commit

Permalink
Added several status checks, upped version
Browse files Browse the repository at this point in the history
  • Loading branch information
JMaynor committed Aug 22, 2024
1 parent b5e5875 commit be9d70e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions ezoff/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ def create_member(member: dict) -> dict:
"Error, could not create member in EZOfficeInventory: " + str(e)
)

if response.status_code != 200:
print(
f"Error {response.status_code}, could not create member in EZOfficeInventory: ",
response.content,
)
raise Exception(
f"Error {response.status_code}, could not create member in EZOfficeInventory: "
+ str(response.content)
)

return response.json()


Expand Down Expand Up @@ -226,6 +236,16 @@ def update_member(member_id: int, member: dict) -> dict:
"Error, could not update member in EZOfficeInventory: " + str(e)
)

if response.status_code != 200:
print(
f"Error {response.status_code}, could not update member in EZOfficeInventory: ",
response.content,
)
raise Exception(
f"Error {response.status_code}, could not update member in EZOfficeInventory: "
+ str(response.content)
)

return response.json()


Expand All @@ -250,6 +270,16 @@ def deactivate_member(member_id: int) -> dict:
"Error, could not deactivate member in EZOfficeInventory: " + str(e)
)

if response.status_code != 200:
print(
f"Error {response.status_code}, could not deactivate member in EZOfficeInventory: ",
response.content,
)
raise Exception(
f"Error {response.status_code}, could not deactivate member in EZOfficeInventory: "
+ str(response.content)
)

return response.json()


Expand All @@ -274,6 +304,16 @@ def activate_member(member_id: int) -> dict:
"Error, could not activate member in EZOfficeInventory: " + str(e)
)

if response.status_code != 200:
print(
f"Error {response.status_code}, could not activate member in EZOfficeInventory: ",
response.content,
)
raise Exception(
f"Error {response.status_code}, could not activate member in EZOfficeInventory: "
+ str(response.content)
)

return response.json()


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name="ezoff",
version="0.1.1",
version="0.1.2",
description="Python package that acts as a wrapper for the EZOffice API.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit be9d70e

Please sign in to comment.