external-request-timeout (E8106)#
An external request has no timeout.
What it does#
Reports calls to network functions without a timeout keyword: requests,
urllib.request.urlopen, http.client, ftplib, smtplib, serial,
suds and Odoo’s IAP jsonrpc. Import aliases are followed.
Why is this bad?#
Without a timeout a request to an unresponsive server blocks an Odoo worker until it is killed, and with it every user waiting on that worker.
Example#
response = requests.get(url)
Use instead:
response = requests.get(url, timeout=10)
Configuration#
[tool.odoo-lint.rules.external-request-timeout]
methods = ["requests.get", "requests.post"]