Request check: Use timeout

This check finds requests methods without a timeout. Without a timeout, requests will hang forever.


The Requests documentation states that timeouts should be used in production code.

You can tell Requests to stop waiting for a response after a given number of seconds with the timeout parameter. Nearly all production code should use this parameter in nearly all requests. Failure to do so can cause your program to hang indefinitely.

This check will detect the following case:

import requests
url = ""
r = requests.get(url)

This case is considered acceptable:

import requests
url = ""
r = requests.get(url, timeout=10)