You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to your official docs, requests return a tuple of (response, status). This is counter-intuitive for me because HTTP status is already present as a property of response, even if the response is other than 2xx:
In [25]: resp, status=jobs_api.getJobDetails('foo')
Non200response:404RequestId:UnknownURL:https://api.smartling.com/jobs-api/v3/projects/3bea86d16/jobs/fooresponse:b'{"response":{"code":"NOT_FOUND_ERROR","errors":[{"key":"not.found","message":"Translation job is not found","details":null}]}}'In [26]: resp.statusCodeOut[26]: 404In [27]: resp.statusCode==statusOut[27]: True
That makes it slightly less convenient to use because for each request I would need to remember to ignore status via resp, _ = ….
Or is there a reason status is separate and I should prefer it over resp.statusCode?
The text was updated successfully, but these errors were encountered:
According to your official docs, requests return a tuple of
(response, status)
. This is counter-intuitive for me because HTTP status is already present as a property ofresponse
, even if the response is other than2xx
:That makes it slightly less convenient to use because for each request I would need to remember to ignore
status
viaresp, _ = …
.Or is there a reason
status
is separate and I should prefer it overresp.statusCode
?The text was updated successfully, but these errors were encountered: