-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Unexpected Behavior: 500 Internal Server Error unhandled by PyCap #261
Comments
Thanks for raising the issue -- what is the body of the response that PyCap fails to capture -- i.e what error message shows for a 500 response? |
@pwildenhain |
Got it! Looks like this piece of the code needs to be updated: Lines 196 to 209 in a507d1a
We should check the status code to see if it's Would you be open to making this contribution? See here for what that might entail: https://github.com/redcap-tools/PyCap/blob/master/CONTRIBUTING.md |
Happy to open a PR. |
Describe the behavior:
When a request is made with PyCap that results in a 500 Internal Server Error response, PyCap's
_RCRequest.get_content
does not handle this error; instead, withformat_type="csv"|"xml"
, an empty string fromresponse.text
is silently returned, and withformat_type="json"
, arequests.exceptions.JSONDecodeError('Expecting value: line 1 column 1 (char 0)')
is raised due toresponse.text
being an empty string.Expected behavior:
The expected behavior would be to detect a 500 code in the request response and emit an informative error from
get_content
.Desktop:
The text was updated successfully, but these errors were encountered: