src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/requestWithoutTimeout.py

branch
eric7
changeset 10996
a3dc181d14e1
parent 10683
779cda568acb
child 11090
f5f5f5803935
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/requestWithoutTimeout.py	Mon Oct 21 16:21:24 2024 +0200
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/requestWithoutTimeout.py	Mon Oct 21 19:31:11 2024 +0200
@@ -4,7 +4,7 @@
 #
 
 """
-Module implementing checks for using requests without timeout.
+Module implementing checks for using 'requests' or 'httpx' calls without timeout.
 """
 
 #
@@ -40,9 +40,12 @@
     @param _config dictionary with configuration data (unused)
     @type dict
     """
-    httpVerbs = ("get", "options", "head", "post", "put", "patch", "delete")
+    httpVerbs = {"get", "options", "head", "post", "put", "patch", "delete"}
+    httpxAttrs = {"request", "stream", "Client", "AsyncClient"} | httpVerbs
     qualName = context.callFunctionNameQual.split(".")[0]
-    if qualName == "requests" and context.callFunctionName in httpVerbs:
+    if (qualName == "requests" and context.callFunctionName in httpVerbs) or (
+        qualName == "httpx" and context.callFunctionName in httpxAttrs
+    ):
         # check for missing timeout
         if context.checkCallArgValue("timeout") is None:
             reportError(
@@ -51,6 +54,7 @@
                 "S114.1",
                 "M",
                 "L",
+                qualName,
             )
 
         # check for timeout=None
@@ -61,4 +65,5 @@
                 "S114.2",
                 "M",
                 "L",
+                qualName,
             )

eric ide

mercurial