简体   繁体   English

的python:requests.exceptions.Timeout与requests.models.Response.status_code 504(网关超时)

[英]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] requests.exceptions.Timeout与VS requests.models.Response.status_code = 504 [网关超时]

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 假设服务s1呼叫了S2

In s1: 在s1中:

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

when will requests.exceptions.Timeout be raised and in what scenario 504 is received. 何时将发出request.exceptions.Timeout以及在什么情况下会收到504。

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). 但是,请求超时异常意味着您的脚本从未连接到服务器,并且等待服务器的响应而超时(即您未建立连接)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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