ó
h€
\c           @   s¡   d  d l  Z  d  d l m Z d  d l m Z d  d l m Z d  d l m Z e  j	 e
 ƒ Z d e f d „  ƒ  YZ d e f d	 „  ƒ  YZ d
 e f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   Settings(   t   ServiceProxy(   t	   Transport(   t   Documentt   Factoryc           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   sG   t  | d | ƒ |  _ | | j k r1 | |  _ n | j | ƒ |  _ d  S(   Ns   get_%s(   t   getattrt   _methodt
   namespacest   _nst   get_ns_prefix(   t   selft   typest   kindt	   namespace(    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyt   __init__   s    c         C   s   |  | S(   s‡   Return the complexType or simpleType for the given localname.

        :rtype: zeep.xsd.ComplexType or zeep.xsd.AnySimpleType

        (    (   R
   t   key(    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyt   __getattr__   s    c         C   s   |  j  d |  j | f ƒ S(   s‡   Return the complexType or simpleType for the given localname.

        :rtype: zeep.xsd.ComplexType or zeep.xsd.AnySimpleType

        s   {%s}%s(   R   R   (   R
   R   (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyt   __getitem__   s    (   t   __name__t
   __module__R   R   R   (    (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyR      s   		t   Clientc           B   s§   e  Z d  Z d d d d d d d „ Z e d „  ƒ Z e d „  ƒ Z d d d „ Z d „  Z	 d „  Z
 d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z RS(   s  The zeep Client.

    :param wsdl:
    :param wsse:
    :param transport: Custom transport class.
    :param service_name: The service name for the service binding. Defaults to
                         the first service in the WSDL document.
    :param port_name: The port name for the default binding. Defaults to the
                      first port defined in the service element in the WSDL
                      document.
    :param plugins: a list of Plugin instances
    :param settings: a zeep.Settings() object

    c         C   s¯   | s t  d ƒ ‚ n  | p! t ƒ  |  _ | d  k	 r9 | n t ƒ  |  _ t | |  j d |  j ƒ|  _ | |  _ | d  k	 r~ | n g  |  _	 d  |  _
 | |  _ | |  _ d  |  _ d  S(   Ns   No URL given for the wsdlt   settings(   t
   ValueErrorR    R   t   NoneR   t	   transportR   t   wsdlt   wsset   pluginst   _default_servicet   _default_service_namet   _default_port_namet   _default_soapheaders(   R
   R   R   R   t   service_namet	   port_nameR   R   (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyR   5   s    				c         C   s   |  j  j j S(   N(   R   R   t
   prefix_map(   R
   (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyR   G   s    c         C   sP   |  j  r |  j  S|  j d |  j d |  j ƒ |  _  |  j  sI t d ƒ ‚ n  |  j  S(   sI   The default ServiceProxy instance

        :rtype: ServiceProxy

        R    R!   sh   There is no default service defined. This is usually due to missing wsdl:service definitions in the WSDL(   R   t   bindR   R   R   (   R
   (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyt   serviceK   s    				c         C   sG   |  j  j s d S|  j | ƒ } |  j | | ƒ } t |  | j | j  S(   s  Create a new ServiceProxy for the given service_name and port_name.

        The default ServiceProxy instance (`self.service`) always referes to
        the first service/port in the wsdl Document.  Use this when a specific
        port is required.

        N(   R   t   servicest   _get_servicet	   _get_portR   t   bindingt   binding_options(   R
   R    R!   R$   t   port(    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyR#   ^   s
    c         C   s`   y |  j  j | } Wn6 t k
 rL t d d j |  j  j j ƒ  ƒ ƒ ‚ n Xt |  | d | ƒS(   s¶   Create a new ServiceProxy for the given binding name and address.

        :param binding_name: The QName of the binding
        :param address: The address of the endpoint

        sA   No binding found with the given QName. Available bindings are: %ss   , t   address(   R   t   bindingst   KeyErrorR   t   joint   keysR   (   R
   t   binding_nameR+   R(   (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyt   create_servicem   s    #c         O   s(   | j  j | | | d |  ƒ\ } } | S(   sZ   Create the payload for the given operation.

        :rtype: lxml.etree._Element

        t   client(   t   _bindingt   _create(   R
   R$   t   operation_namet   argst   kwargst   envelopet   http_headers(    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyt   create_message|   s    	c         C   s   t  |  j j d | ƒ S(   sÃ   Return a type factory for the given namespace.

        Example::

            factory = client.type_factory('ns0')
            user = factory.User(name='John')

        :rtype: Factory

        t   type(   R   R   R   (   R
   R   (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyt   type_factory†   s    c         C   s   |  j  j j | ƒ S(   sw   Return the type for the given qualified name.

        :rtype: zeep.xsd.ComplexType or zeep.xsd.AnySimpleType

        (   R   R   t   get_type(   R
   t   name(    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyR=   “   s    c         C   s   |  j  j j | ƒ S(   s\   Return the element for the given qualified name.

        :rtype: zeep.xsd.Element

        (   R   R   t   get_element(   R
   R>   (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyR?   ›   s    c         C   s   |  j  j j | | ƒ d S(   s1   Set a shortcut for the given namespace.

        N(   R   R   t   set_ns_prefix(   R
   t   prefixR   (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyR@   £   s    c         C   s   | |  _  d S(   s  Set the default soap headers which will be automatically used on
        all calls.

        Note that if you pass custom soapheaders using a list then you will
        also need to use that during the operations. Since mixing these use
        cases isn't supported (yet).

        N(   R   (   R
   t   headers(    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyt   set_default_soapheaders©   s    	c         C   sM   | r0 | j  j | ƒ } | sI t d ƒ ‚ qI n t | j  j ƒ  ƒ d } | S(   Ns   Port not foundi    (   t   portst   getR   t   listt   values(   R
   R$   R>   R*   (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyR'   ´   s    c         C   sX   | r3 |  j  j j | ƒ } | sT t d ƒ ‚ qT n! t t |  j  j j ƒ  ƒ d  ƒ } | S(   Ns   Service not found(   R   R%   RE   R   t   nextt   iterRG   R   (   R
   R>   R$   (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyR&   ½   s    !N(   R   R   t   __doc__R   R   t   propertyR   R$   R#   R1   R:   R<   R=   R?   R@   RC   R'   R&   (    (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyR   %   s    			
							t   CachingClientc           B   s   e  Z d  Z d „  Z RS(   s±   Shortcut to create a caching client, for the lazy people.

    This enables the SqliteCache by default in the transport as was the default
    in earlier versions of zeep.

    c         O   sR   d d l  m } | j d ƒ p. t d | ƒ  ƒ | d <t t |  ƒ j | | Ž  d  S(   Niÿÿÿÿ(   t   SqliteCacheR   t   cache(   t
   zeep.cacheRM   RE   R   t   superRL   R   (   R
   R6   R7   RM   (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyR   Î   s    %(   R   R   RJ   R   (    (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyRL   Ç   s   (   t   loggingt   zeep.settingsR    t
   zeep.proxyR   t   zeep.transportsR   t	   zeep.wsdlR   t	   getLoggerR   t   loggert   objectR   R   RL   (    (    (    s@   /data/av2000/b2b/venv/lib/python2.7/site-packages/zeep/client.pyt   <module>   s   ¢