3
ûâde  ã               @   sx   d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 dd„ Zd	d
„ Zdd„ Zddd„Zedkrteƒ  dS )é    N)Úrequests)ÚCacheControlAdapter)Ú	DictCache)Úlogger)ÚArgumentParserc              C   s"   t jtjƒ tjƒ } t j| ƒ d S )N)r   ÚsetLevelÚloggingÚDEBUGÚStreamHandlerÚ
addHandler)Úhandler© r   ú</tmp/pip-build-red6nood/pip/pip/_vendor/cachecontrol/_cmd.pyÚsetup_logging   s    r   c              C   s>   t tƒ dd d d�} tjƒ }|jd| ƒ |jd| ƒ | j|_|S )NT)Úcache_etagsÚ
serializerÚ	heuristiczhttp://zhttps://)r   r   r   ÚSessionÚmountÚ
controllerÚcache_controller)ÚadapterÚsessr   r   r   Úget_session   s    r   c              C   s   t ƒ } | jddd� | jƒ S )NÚurlzThe URL to try and cache)Úhelp)r   Úadd_argumentÚ
parse_args)Úparserr   r   r   Úget_args   s    r   c             C   sT   t ƒ } tƒ }|j| jƒ}tƒ  |jj|j|jƒ |jj	|jƒrHt
dƒ n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   Úmain$   s    
r(   Ú__main__)N)r   Úpip._vendorr   Z pip._vendor.cachecontrol.adapterr   Zpip._vendor.cachecontrol.cacher   Z#pip._vendor.cachecontrol.controllerr   Úargparser   r   r   r   r(   Ú__name__r   r   r   r   Ú<module>   s   
