Ñò
ýÉªWc           @   s_   d  d k  Z  d  d k Z d  d k Z d e f d „  ƒ  YZ d „  Z e d j o e ƒ  n d S(   iÿÿÿÿNt   HttpRequestDecoratorc           B   s>   e  Z d  Z e d d d d „ ƒ Z e d e i d „ ƒ Z RS(   s&   A simple wrapper for HTTP/URL request.t   GETc      	   C   s“   d } d } t i d d t d d ƒ} t | _ x\ t | ƒ D]N } y | i |  | | | ƒ } Wq= t i j
 o d | d | f GHq= Xq= W| S(	   s\   Catches some unexcepted errors raised by httplib2.Http.request which may need to be ignored.i   s   .cachet"   disable_ssl_certificate_validationt   timeouti,  sU   An error of httplib2.SSLHandshakeError has been catched, ignore it %d/%d and retry...i   N(   t   Nonet   httplib2t   Httpt   Truet   force_exception_to_status_codet   ranget   requestt   SSLHandshakeError(   t   req_urlt   methodt   bodyt   headerst   respt   max_numt   ht   i(    (    sn   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/HttpRequestDecorator.pyR
      s    	 	c         C   sl   d } d } xY t | ƒ D]K } y t i |  | | ƒ } Wq t i j
 o d | d | f GHq Xq W| S(   sV   Catches some unexcepted errors raised by urllib2.urlopen which may need to be ignored.i   sK   An error of urllib2.URLError has been catched, ignore it %d/%d and retry...i   N(   R   R	   t   urllib2t   urlopent   URLError(   t   urlt   dataR   R   R   R   (    (    sn   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/HttpRequestDecorator.pyR      s     	N(	   t   __name__t
   __module__t   __doc__t   staticmethodR   R
   t   sockett   _GLOBAL_DEFAULT_TIMEOUTR   (    (    (    sn   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/HttpRequestDecorator.pyR       s
   c          C   s   t  i d ƒ }  |  GHd  S(   Ns!   https://10.116.5.121:8443/portal/(   R    R
   (   t   resp1(    (    sn   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/HttpRequestDecorator.pyt   main-   s    t   __main__(   R   R   R   t   objectR    R    R   (    (    (    sn   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/HttpRequestDecorator.pyt   <module>   s   %	