external-request-timeout (ODOO051)
Preview (since 0.16.2.5) · Related issues · View source
Derived from the odoo linter.
This rule is unstable and in preview. The --preview flag is required for use.
What it does
Checks for calls to external request methods (requests.get, urllib.request.urlopen,
smtplib.SMTP, ...) without an explicit timeout keyword argument.
Why is this bad?
Without a timeout these calls can block forever on an unresponsive peer, hanging the Odoo worker that runs them.
Example
Use instead:
Overlap with S113
S113 (request-without-timeout) detects the requests.*/httpx.* subset of this
rule. This rule additionally covers ftplib, http.client, smtplib, serial,
suds, urllib.request.urlopen and Odoo's IAP jsonrpc, matching pylint-odoo's
external-request-timeout default list — enable one of the two, not both, to avoid
duplicated reports on requests calls.