简体   繁体   中英

python: requests.exceptions.Timeout vs requests.models.Response.status_code 504 ( gateway timeout )

requests.exceptions.Timeout VS requests.models.Response.status_code = 504 [gateway timeout]

what is the actual difference between the two as both deals with saying timeout has occurred?

Let us say Service s1 makes call to S2

In s1:

request.post( url=s2,..., timeout=60 )

when will requests.exceptions.Timeout be raised and in what scenario 504 is received.

Can retries be made for all of those exceptions - I believe answer for above question might give lead to this..

Thanks in advance.

The gateway timeout means the connected server had some sort of timeout after receiving your request(ie you did make a connection). However, the requests timeout exception means your script never connected to the server and timed out waiting on a response from the server (ie you did not make a connection).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM