ó
ŒGUc           @   s  d  Z  d Z d Z d Z d Z d Z d Z d d l Z d d l Z e j	 d	 d
 k rž e
 Z d d l m Z m Z m Z m Z m Z m Z m Z m Z m Z nU d d l Z e j Z d d l m Z m Z m Z m Z m Z m Z m Z m Z m Z d d l m Z e j e ƒ Z d „  Z d S(   sT   urllib2 style build opener integrates with HTTPSConnection class from this
package.
s   P J Kershaws   21/12/10s2   (C) 2011 Science and Technology Facilities Councils-   BSD - see LICENSE file in top-level directorys   Philip.Kershaw@stfc.ac.uks   $Id$iÿÿÿÿNi    i   (	   t   ProxyHandlert   UnknownHandlert   HTTPDefaultErrorHandlert
   FTPHandlert   FileHandlert   HTTPErrorProcessort   HTTPHandlert   OpenerDirectort   HTTPRedirectHandler(   t   HTTPSContextHandlerc          O   sY  d „  } t  ƒ  } t t t t t t t t g } t	 | ƒ } | j
 t ƒ g  } xl | D]d } x[ |  D]S } | | ƒ r— t | | ƒ r¶ | j
 | ƒ q¶ qc t | | ƒ rc | j
 | ƒ qc qc WqV Wx- | D]% } | | k rÅ | j | ƒ  ƒ qÅ qÅ W| j d ƒ }	 t | k r| j t |	 ƒ ƒ n  x3 |  D]+ }
 | |
 ƒ rD|
 ƒ  }
 n  | j |
 ƒ q&W| S(   s  Create an opener object from a list of handlers.

    The opener will use several default handlers, including support
    for HTTP and FTP.

    If any of the handlers passed as arguments are subclasses of the
    default handlers, the default handlers will not be used.
    c         S   s   t  |  t ƒ p t |  d ƒ S(   Nt	   __bases__(   t
   isinstancet   class_type_t   hasattr(   t   obj(    (    sH   /usr/lib/python2.7/dist-packages/ndg/httpsclient/urllib2_build_opener.pyt   isclass,   s    t   ssl_context(   R   R    R   R   R   R   R   R   R   t   listt   appendR	   t
   issubclassR   t   add_handlert   get(   t   handlerst   kwR   t   openert   default_classest   check_classest   skipt   klasst   checkR   t   h(    (    sH   /usr/lib/python2.7/dist-packages/ndg/httpsclient/urllib2_build_opener.pyt   build_opener#   s4    				(   t   __doc__t
   __author__t   __date__t   __copyright__t   __license__t   __contact__t   __revision__t   loggingt   syst   version_infot   typeR   t   urllib.requestR    R   R   R   R   R   R   R   R   t   typest	   ClassTypet   urllib2t   ndg.httpsclient.httpsR	   t	   getLoggert   __name__t   logR   (    (    (    sH   /usr/lib/python2.7/dist-packages/ndg/httpsclient/urllib2_build_opener.pyt   <module>   s"   C	@