ó
šxTc           @   sw   d  d l  Z  d  d l Z d „  Z d e _ e d e j g ƒ e _ d Z e j ƒ  Z d e	 f d „  ƒ  YZ
 d „  Z d S(	   iÿÿÿÿNc         C   s
   |  j  ƒ  S(   N(   t   read(   t   stream(    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/pipeline/proxy/common.pyt   simple   s    t   identityt    s2   HTTPInterface/0.0.2 +http://www.phenix-online.org/t   Downloadc           B   s   e  Z d i  e d  „ Z RS(   c         C   s´   t  j d | d | r$ t j | ƒ n d  d t | j ƒ  d t f d | j f g ƒ ƒ } t	 j
 | ƒ } | j j d d ƒ j ƒ  | j k rž t d | j ‚ n  | d	 | ƒ |  _ d  S(
   Nt   urlt   datat   headerss
   User-Agents   Accept-encodings   Content-EncodingR   s$   Service does not support encoding %sR   (   t   urllib2t   Requestt   urllibt	   urlencodet   Nonet   dictt   itemst   AGENTt   ENCODINGt   OPENERt   openR   t   gett   lowert   ACCEPTt   RuntimeErrorR   (   t   selfR   R   R   t   methodt   requestR   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/pipeline/proxy/common.pyt   __init__   s    		$N(   t   __name__t
   __module__R   R   R   (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/pipeline/proxy/common.pyR      s   c         C   s/   y t  j |  ƒ } Wn t j k
 r* t SXt S(   N(   R   R   R	   t   URLErrort   Falset   True(   R   R   (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/pipeline/proxy/common.pyt	   is_online'   s
    (   R   R	   R   R   t   setR   R   t   build_openerR   t   objectR   R!   (    (    (    sJ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/phaser/pipeline/proxy/common.pyt   <module>   s   		