question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calls to requests.get() and requests.post() are missing the timeout parameter

See original GitHub issue

We’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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
stale[bot]commented, Apr 27, 2020

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! 🙇‍♂️

1reaction
stale[bot]commented, Jan 26, 2020

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! 🙇‍♂️

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found