
    AHj                         d Z ddlZddlZ ej                  e      Z ej                          ej                  j                  dddg dd      Z	 ej                  dd	e	d
      Zh dZdedefdZy)z-
Functions devoted to requests over the WWW.
    N   F)i  i  i  i  i  i  i  i  i	  i
  i  i  i  i  i  i  iV     )totalredirectraise_on_redirectstatus_forcelistbackoff_factor	CERT_NONEd   
   )	cert_reqs	num_poolsretriestimeout>
   ,  -  .  /  0  1  2  3  4     urlreturnc                 L   	 t         j                  d|       }|j                  t        v r7|j                         xs | }t        j                  d||j                         |S t        d|        # t        $ r+}t        j	                  d| |       t        d|        |d}~ww xY w)zTest final URL to handle redirects
    Args:
        url: url to check

    Returns:
        The final URL seen.

    Raises:
        ValueError: if the URL cannot be reached or returns an unacceptable status.
    HEADzcannot reach URL: %s %szcannot reach URL: Nzresult found: %s %s)
	HTTP_POOLrequest	ExceptionLOGGERwarning
ValueErrorstatusACCEPTABLE_CODESgeturldebug)r   rheaderr	final_urls       G/root/tools/cai/cai_env/lib/python3.12/site-packages/courlan/network.pyredirection_testr-   .   s    >!!&#.
 ||''LLN)c	*Iu||D
)#/
00  >0#s;-cU34#=>s   A/ /	B#8&BB#)__doc__loggingurllib3	getLogger__name__r"   disable_warningsutilRetryRETRY_STRATEGYPoolManagerr   r&   strr-        r,   <module>r;      s     			8	$     ##
& / $ 2  GS."	 F 1# 1# 1r:   