Skip to content

Commit

Permalink
Convert bytes to string
Browse files Browse the repository at this point in the history
  • Loading branch information
kdp-cloud committed Feb 10, 2025
1 parent 829cdee commit d642da8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mars-cli/mars_lib/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,11 @@ def upload_to_metabolights(
)
submission_response.raise_for_status()
if submission_response.json().get("errors", []):
response_body = submission_response.request.body
if isinstance(response_body, bytes):
response_body = response_body.decode("utf-8")
raise requests.HTTPError(
f"Request towards MetaboLights failed!\nRequest:\nMethod:{submission_response.request.method}\nStatus:{submission_response.status_code}\nURL:{submission_response.request.url}\nHeaders:{submission_response.request.headers}\nBody:{submission_response.request.body}"
f"Request towards MetaboLights failed!\nRequest:\nMethod:{submission_response.request.method}\nStatus:{submission_response.status_code}\nURL:{submission_response.request.url}\nHeaders:{submission_response.request.headers}\nBody:{response_body}"
)

result = submission_response.json()
Expand Down

0 comments on commit d642da8

Please sign in to comment.