1

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.

nkkrishnak
  • 397
  • 1
  • 3
  • 12

1 Answers1

0

The gateway timeout means the connected server had some sort of timeout after receiving your request(i.e. 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 (i.e. you did not make a connection).

Jay Atkinson
  • 3,279
  • 2
  • 27
  • 41
  • I am getting request.timeout.exception in s1 - but still in service s2 i am able to see corresponding entry in DB , which confirms that call reached S2. [ which implies connection was actually made ] – nkkrishnak Mar 02 '17 at 14:46
  • s1 may not be responding anymore. I really don't know what s1 and s2 are, but my experience with requests is that the timeout exception means the server has stopped responding that you're making a connection. The gateway timeout is an actual server reply. – Jay Atkinson Mar 02 '17 at 14:48
  • s1 service1 I meant the caller ( client ) and S2 service2 I meant the server. – nkkrishnak Mar 02 '17 at 14:52
  • Just going thr the docs :::http://docs.python-requests.org/en/master/_modules/requests/exceptions/ -- By the docs in ReadTimeout -we did make a connection – nkkrishnak Mar 02 '17 at 15:01
  • okay.. then the server is just not responding anymore after connection. – Jay Atkinson Mar 02 '17 at 16:18