Skip to content

Commit

Permalink
Use response instead of req; remove indentation after return
Browse files Browse the repository at this point in the history
Co-authored-by: Jasper Craeghs <[email protected]>
  • Loading branch information
JokeWaumans and JasperCraeghs authored Aug 5, 2024
1 parent bb0cd2d commit c1cb908
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions mlx/coverity_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,16 @@ def _get_request(self, url):
Raises:
requests.HTTPError
"""
req = self.session.get(url)
if req.ok:
return json.loads(req.content)
else:
try:
message = json.loads(req.content)["message"]
except:
message = req.content.decode()
logger = getLogger("coverity_logging")
logger.warning(message)
return req.raise_for_status()
response= self.session.get(url)
if response.ok:
return response.json()
try:
err_msg= response.json()["message"]
except (requests.exceptions.JSONDecodeError, KeyError):
err_msg= response.content.decode()
logger = getLogger("coverity_logging")
logger.warning(err_msg)
return response.raise_for_status()

def _post_request(self, url, data):
"""Perform a POST request to the specified url.
Expand Down

0 comments on commit c1cb908

Please sign in to comment.