o
    ÖèFhˆ  ã                   @  s²   d dl mZ d dlZd dlmZ d dlmZ d dlZd dlm	Z	 d dl
mZ d dlmZ er:d dlmZ d d	lmZ ddd„Zddd„Zddd„Zddd„ZedkrWeƒ  dS dS )é    )ÚannotationsN)ÚArgumentParser)ÚTYPE_CHECKING)ÚCacheControlAdapter)Ú	DictCache)Úlogger)Ú	Namespace)ÚCacheControllerÚreturnÚNonec                  C  s"   t  tj¡ t ¡ } t  | ¡ d S )N)r   ÚsetLevelÚloggingÚDEBUGÚStreamHandlerÚ
addHandler)Úhandler© r   úJ/var/www/html/loop/nvenv/lib/python3.10/site-packages/cachecontrol/_cmd.pyÚsetup_logging   s   r   úrequests.Sessionc                  C  s>   t tƒ dd d d�} t ¡ }| d| ¡ | d| ¡ | j|_|S )NT)Úcache_etagsÚ
serializerÚ	heuristiczhttp://zhttps://)r   r   ÚrequestsÚSessionÚmountÚ
controllerÚcache_controller)ÚadapterÚsessr   r   r   Úget_session   s   
ÿr    r   c                  C  s   t ƒ } | jddd� |  ¡ S )NÚurlzThe URL to try and cache)Úhelp)r   Úadd_argumentÚ
parse_args)Úparserr   r   r   Úget_args(   s   r&   c                  C  sX   t ƒ } tƒ }| | j¡}tƒ  |j}| |j|j¡ | 	|j¡r&t
dƒ d S t
dƒ d S )NzCached!zNot cached :()r&   r    Úgetr!   r   r   Úcache_responseÚrequestÚrawÚcached_requestÚprint)Úargsr   Úrespr   r   r   r   Úmain.   s   ÿr/   Ú__main__)r
   r   )r
   r   )r
   r   )Ú
__future__r   r   Úargparser   Útypingr   r   Úcachecontrol.adapterr   Úcachecontrol.cacher   Úcachecontrol.controllerr   r   r	   r   r    r&   r/   Ú__name__r   r   r   r   Ú<module>   s$   




ÿ