ó
þ¡hKc           @   sx   d  Z  d d l Z d d l Td d l m Z d d l m Z e e ƒ Z	 d e f d „  ƒ  YZ
 d e
 f d	 „  ƒ  YZ d S(
   sL   
Contains classes for basic HTTP (authenticated) transport implementations.
iÿÿÿÿN(   t   *(   t   HttpTransport(   t	   getLoggert   HttpAuthenticatedc           B   sD   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s<  
    Provides basic http authentication that follows the RFC-2617 specification.
    As defined by specifications, credentials are provided to the server
    upon request (HTTP/1.0 401 Authorization Required) by the server only.
    @ivar pm: The password manager.
    @ivar handler: The authentication handler.
    c         K   s#   t  j |  | � t j ƒ  |  _ d S(   sš  
        @param kwargs: Keyword arguments.
            - B{proxy} - An http proxy to be specified on requests.
                 The proxy is defined as {protocol:proxy,}
                    - type: I{dict}
                    - default: {}
            - B{timeout} - Set the url open timeout (seconds).
                    - type: I{float}
                    - default: 90
            - B{username} - The username used for http authentication.
                    - type: I{str}
                    - default: None
            - B{password} - The password used for http authentication.
                    - type: I{str}
                    - default: None
        N(   R   t   __init__t   u2t   HTTPPasswordMgrWithDefaultRealmt   pm(   t   selft   kwargs(    (    sN   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/transport/https.pyR   &   s    c         C   s   |  j  | ƒ t j |  | ƒ S(   N(   t   addcredentialsR   t   open(   R   t   request(    (    sN   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/transport/https.pyR   :   s    c         C   s   |  j  | ƒ t j |  | ƒ S(   N(   R
   R   t   send(   R   R   (    (    sN   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/transport/https.pyR   >   s    c         C   sO   |  j  ƒ  } d  | k rK | d } | d } |  j j d  | j | | ƒ n  d  S(   Ni    i   (   t   credentialst   NoneR   t   add_passwordt   url(   R   R   R   t   ut   p(    (    sN   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/transport/https.pyR
   B   s
    

c         C   s   |  j  j |  j  j f S(   N(   t   optionst   usernamet   password(   R   (    (    sN   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/transport/https.pyR   I   s    c         C   s,   t  j |  ƒ } | j t j |  j ƒ ƒ | S(   N(   R   t
   u2handlerst   appendR   t   HTTPBasicAuthHandlerR   (   R   t   handlers(    (    sN   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/transport/https.pyR   L   s    (	   t   __name__t
   __module__t   __doc__R   R   R   R
   R   R   (    (    (    sN   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/transport/https.pyR      s   					t   WindowsHttpAuthenticatedc           B   s   e  Z d  Z d „  Z RS(   s§   
    Provides Windows (NTLM) http authentication.
    @ivar pm: The password manager.
    @ivar handler: The authentication handler.
    @author: Christopher Bess
    c         C   s`   y d d l  m } Wn t k
 r3 t d ƒ ‚ n Xt j |  ƒ } | j | j |  j ƒ ƒ | S(   Niÿÿÿÿ(   t   HTTPNtlmAuthHandlers    Cannot import python-ntlm module(   t   ntlmR   t   ImportErrort	   ExceptionR   R   R   R   (   R   R   R   (    (    sN   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/transport/https.pyR   Z   s    (   R   R   R   R   (    (    (    sN   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/transport/https.pyR   R   s   (   R   t   urllib2R   t   suds.transportt   suds.transport.httpR   t   loggingR   R   t   logR   R   (    (    (    sN   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/suds/transport/https.pyt   <module>   s   
5