Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise error if request fails #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
19 changes: 11 additions & 8 deletions tap_chargebee/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,17 @@ def make_request(self, url, method, params=None, body=None):
params = {}

LOGGER.info("Making {} request to {} with the following params {}".format(method, url, params))

response = requests.request(
method,
url,
auth=(self.config.get("api_key"), ''),
headers=self.get_headers(),
params=self.get_params(params),
json=body)

try:
response = requests.request(
method,
url,
auth=(self.config.get("api_key"), ''),
headers=self.get_headers(),
params=self.get_params(params),
json=body)
except Exception as e:
raise Exception(e)

if response.status_code == 429:
sleep_time = response.headers.get("Retry-After", 60)
Expand Down