Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cbpro/public_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,18 @@ def _send_message(self, method, endpoint, params=None, data=None):
url = self.url + endpoint
r = self.session.request(method, url, params=params, data=data,
auth=self.auth, timeout=30)

if r.status_code != 200:
"""This should catch all errors that coinbase throws.

You will need to handle the default error response of 'message'
in your code but will prevent any crashes or exceptions that may pop up
during runtime.

"""
print(f"Request Error: {r.status_code} - ret")
return {'message'}
return r.json()

def _send_paginated_message(self, endpoint, params=None):
""" Send API message that results in a paginated response.

Expand Down