Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
with sessions.Session() as session:
response = session.send(prep_req)
if response.status_code == 200:
if (response.content and hasattr(response.content, "decode")):
return response.content.decode("utf-8")
return response.content
if response.status_code == 401:
raise SplitwiseUnauthorizedException("Please check your token or consumer id and secret", response=response)
if response.status_code == 403:
raise SplitwiseNotAllowedException("You are not allowed to perform this operation", response=response)
if response.status_code == 400:
raise SplitwiseBadRequestException("Please check your request", response=response)
if response.status_code == 404:
raise SplitwiseNotFoundException("Required resource is not found", response)
raise SplitwiseException("Unknown error happened", response)