summaryrefslogtreecommitdiff
path: root/doc/data/messages/m/missing-timeout/bad.py
Commit message (Collapse)AuthorAgeFilesLines
* [ADD] missing-timeout: Used when a method call an external request (#6780)Moises Lopez - https://www.vauxoo.com/2022-06-231-0/+3
Calling external request needs to use timeout in order to avoid waiting for a long time You can even reproduce the case using deelay.me e.g. ```python import requests response = requests.get("https://deelay.me/5000/http://localhost:80") # It will spend 5s response = requests.get("https://deelay.me/5000/http://localhost:80", timeout=2) # timeout response = requests.get("https://deelay.me/1000/http://localhost:80", timeout=2) # fine ``` After 2s if the request doesn't have response it raises the following exception requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='deelay.me', port=443): Read timed out. (read timeout=2) But if it responses <=1s it is fine Now you can test the same but using a bigger delay