schubergphilis / towerlib

A python library to interface with ansible tower's (awx) api.
MIT License
43 stars 39 forks source link

Add default timeout for all requests #116

Closed sspans-sbp closed 1 year ago

sspans-sbp commented 1 year ago

From the requests documentation:

Most requests to external servers should have a timeout attached, in case the server is not responding in a timely manner. By default, requests do not time out unless a timeout value is set explicitly. Without a timeout, your code may hang for minutes or more.

The connect timeout is the number of seconds Requests will wait for your client to establish a connection to a remote machine (corresponding to the connect()) call on the socket. It’s a good practice to set connect timeouts to slightly larger than a multiple of 3, which is the default TCP packet retransmission window.

costastf commented 1 year ago

Excellent!

costastf commented 1 year ago

My only suggestion would be to move the timeout argument to the end of the arguments so the compatibility for positional stays intact.