Calls to requests.get() and requests.post() are missing the timeout parameter
See original GitHub issueWe’ve encountered issues in our production environment for weeks and after some digging, released that calls to requests.get() and requests.post() and missing the timeout parameter, causing the server to hang indefinitely on occasion if no response is received.
In our specific case, the problem is with these instances:
class AuthenticationBase(object):
def post(self, url, data=None, headers=None):
response = requests.post(url=url, data=json.dumps(data),
headers=headers)
return self._process_response(response)
def get(self, url, params=None, headers=None):
return requests.get(url=url, params=params, headers=headers).text
but there may well be others.
As noted on the requests documentation:
Nearly all production code should use this parameter in nearly all requests. Failure to do so can cause your program to hang indefinitely
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Why doesn't requests.get() return? What is the default timeout ...
It happens a lot to me that requests.get() takes a very long time to return even if the timeout is 1 second. There...
Read more >missing-timeout / W3101 - Pylint 2.16.0-dev documentation
Description: Used when a method needs a 'timeout' parameter in order to avoid waiting for a long time. If no timeout is specified...
Read more >How do I set a timeout for Python Requests? - ReqBin
To set a timeout for the Python Requests library, you can pass the "timeout" parameter for GET, POST, PUT, HEAD, and DELETE methods....
Read more >Timeouts in Python requests - Datagy
In this tutorial, you'll learn how to use timeouts in the Python requests library, when working with any type of HTTP request being...
Read more >Timeout in Python requests – Everything you need to know
You can tell requests library to stop waiting for a response after a given amount of time by passing a number to the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇♂️
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇♂️