
    >/i                         S r SSKrSSKJr  SSKJr  \R                  " S5      \R                  " S5      S 5       5       rg)a  
=======================================
B113: Test for missing requests timeout
=======================================

This plugin test checks for ``requests`` or ``httpx`` calls without a timeout
specified.

Nearly all production code should use this parameter in nearly all requests,
Failure to do so can cause your program to hang indefinitely.

When request methods are used without the timeout parameter set,
Bandit will return a MEDIUM severity error.


:Example:

.. code-block:: none

    >> Issue: [B113:request_without_timeout] Call to requests without timeout
       Severity: Medium   Confidence: Low
       CWE: CWE-400 (https://cwe.mitre.org/data/definitions/400.html)
       More Info: https://bandit.readthedocs.io/en/latest/plugins/b113_request_without_timeout.html
       Location: examples/requests-missing-timeout.py:3:0
    2
    3   requests.get('https://gmail.com')
    4   requests.get('https://gmail.com', timeout=None)

    --------------------------------------------------
    >> Issue: [B113:request_without_timeout] Call to requests with timeout set to None
       Severity: Medium   Confidence: Low
       CWE: CWE-400 (https://cwe.mitre.org/data/definitions/400.html)
       More Info: https://bandit.readthedocs.io/en/latest/plugins/b113_request_without_timeout.html
       Location: examples/requests-missing-timeout.py:4:0
    3   requests.get('https://gmail.com')
    4   requests.get('https://gmail.com', timeout=None)
    5   requests.get('https://gmail.com', timeout=5)

.. seealso::

 - https://requests.readthedocs.io/en/latest/user/advanced/#timeouts

.. versionadded:: 1.7.5

.. versionchanged:: 1.7.10
    Added check for httpx module

    N)issue)test_propertiesCallB113c                 l   1 Skn1 SkU-  nU R                   R                  S5      S   nUS:X  aq  U R                  U;   aa  U R                  S5      cO  [        R
                  " [        R                  [        R                  [        R                  R                  SU S3S	9$ US:X  a  U R                  U;   d  US
:X  ax  U R                  U;   ag  U R                  SS5      (       aO  [        R
                  " [        R                  [        R                  [        R                  R                  SU S3S	9$ g g g )N>   getputheadpostpatchdeleteoptions>   ClientstreamrequestAsyncClient.r   requeststimeoutzCall to z without timeout)severity
confidencecwetexthttpxNonez with timeout set to None)call_function_name_qualsplitcall_function_namecheck_call_arg_valuebanditIssueMEDIUMLOWr   Cwe!UNCONTROLLED_RESOURCE_CONSUMPTION)context
HTTP_VERBSHTTPX_ATTRSqualnames       `/home/james-whalen/.local/lib/python3.13/site-packages/bandit/plugins/request_without_timeout.pyrequest_without_timeoutr+   7   s    NJ@:MK..44S9!<H:'"<"<
"J''	2:<<!::II??z)9:	  	J&&*4w&&+5 ''	6::<<!::II??z)BC	  ; 6     )	__doc__r    bandit.corer   r   testcheckstest_idr+    r,   r*   <module>r3      sD   /`   / Vf  r,   