Skip to content

Commit

Permalink
remove json.load
Browse files Browse the repository at this point in the history
  • Loading branch information
Karina5005 committed Aug 28, 2023
1 parent f84b3ee commit 900da5b
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions backup_github/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,18 @@ def __init__(self, message=None):
def raise_by_status(self, response):
if response.status_code == 403:
logging.warning("Status is 403 - Rate limit exceeded exception")
raise self.RateLimitExceededException(
json.loads(response.content) if response.content else None
)
raise self.RateLimitExceededException(response.content)
elif response.status_code == 404:
logging.warning(
f"Status is {response.status_code} - Client error: Not found"
)
raise self.ClientError(
json.loads(response.content) if response.content else None
)
raise self.ClientError(response.content)
elif 400 <= response.status_code < 500:
logging.warning(f"Status is {response.status_code} - Client error")
raise self.ClientError(
json.loads(response.content) if response.content else None
)
raise self.ClientError(response.content)
elif 500 <= response.status_code < 600:
logging.warning(f"Status is {response.status_code} - Server error")
raise self.ServerError(
json.loads(response.content) if response.content else None
)
raise self.ServerError(response.content)

def retry(func):
def ret(self, *args, **kwargs):
Expand Down

0 comments on commit 900da5b

Please sign in to comment.