summaryrefslogtreecommitdiff
path: root/doc/data/messages/m/missing-timeout/good.py
diff options
context:
space:
mode:
authorMoises Lopez - https://www.vauxoo.com/ <moylop260@vauxoo.com>2022-06-23 00:48:29 -0500
committerGitHub <noreply@github.com>2022-06-23 07:48:29 +0200
commit76bcfda64d4fef8706d06ad9458ef2461bf762a0 (patch)
tree91bac8f7e3beb70db207548fd649780e9f07fc1e /doc/data/messages/m/missing-timeout/good.py
parent02e9023865419635f155d8c8a6dc1b14d5104d3c (diff)
downloadpylint-git-76bcfda64d4fef8706d06ad9458ef2461bf762a0.tar.gz
[ADD] missing-timeout: Used when a method call an external request (#6780)
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
Diffstat (limited to 'doc/data/messages/m/missing-timeout/good.py')
-rw-r--r--doc/data/messages/m/missing-timeout/good.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/doc/data/messages/m/missing-timeout/good.py b/doc/data/messages/m/missing-timeout/good.py
new file mode 100644
index 000000000..dbeb51255
--- /dev/null
+++ b/doc/data/messages/m/missing-timeout/good.py
@@ -0,0 +1,3 @@
+import requests
+
+requests.post("http://localhost", timeout=10)