o
    g                     @   s\   d Z ddlmZ ddlmZmZ ddgZG dd deZG dd deZG d	d deZ	d
S )z:
    zeep.wsdl.messages.http
    ~~~~~~~~~~~~~~~~~~~~~~~

    )xsd)ConcreteMessageSerializedMessage
UrlEncodedUrlReplacementc                   @   s   e Zd ZdZdd ZdS )HttpMessagez$Base class for HTTP Binding messagesc                 C   sn   || _ g }| j j D ]\}}|jr|j|}nt||j}|| qt| j	j
tt|| _d S N)abstractpartsitemselementcloner   Elementtypeappend	operationnameComplexTypeSequencebody)selfdefinitionsabstract_messagechildrenr   messageelm r   P/home/ubuntu/webapp/venv/lib/python3.10/site-packages/zeep/wsdl/messages/http.pyresolve   s   
zHttpMessage.resolveN)__name__
__module____qualname____doc__r   r   r   r   r   r      s    r   c                   @   $   e Zd ZdZdd Zedd ZdS )r   a  The urlEncoded element indicates that all the message parts are encoded
    into the HTTP request URI using the standard URI-encoding rules
    (name1=value&name2=value...).

    The names of the parameters correspond to the names of the message parts.
    Each value contributed by the part is encoded using a name=value pair. This
    may be used with GET to specify URL encoding, or with POST to specify a
    FORM-POST. For GET, the "?" character is automatically appended as
    necessary.

    c                 O   sR   dd | j j D }|t| j j | || ddi}t| jj||dS )Nc                 S      i | ]}|d qS r   r   .0keyr   r   r   
<dictcomp>-       z(UrlEncoded.serialize.<locals>.<dictcomp>Content-Typetext/xml; charset=utf-8pathheaderscontent)r	   r
   keysupdatezipr   r   location)r   argskwargsparamsr.   r   r   r   	serialize,   s   

zUrlEncoded.serializec                 C      | d}| |j||}|S Nr   getwsdlclsr   
xmlelementr   r   objr   r   r   parse5      
zUrlEncoded.parseNr   r    r!   r"   r7   classmethodrA   r   r   r   r   r      s
    	c                   @   r#   )r   ao  The http:urlReplacement element indicates that all the message parts
    are encoded into the HTTP request URI using a replacement algorithm.

    - The relative URI value of http:operation is searched for a set of search
      patterns.
    - The search occurs before the value of the http:operation is combined with
      the value of the location attribute from http:address.
    - There is one search pattern for each message part. The search pattern
      string is the name of the message part surrounded with parenthesis "("
      and ")".
    - For each match, the value of the corresponding message part is
      substituted for the match at the location of the match.
    - Matches are performed before any values are replaced (replaced values do
      not trigger additional matches).

    Message parts MUST NOT have repeating values.
    <http:urlReplacement/>

    c                 O   s   dd | j j D }|t| j j | || ddi}| jj}| D ]\}}|d| |d ur7|nd}q(t	||ddS )Nc                 S   r$   r   r   r%   r   r   r   r(   R   r)   z,UrlReplacement.serialize.<locals>.<dictcomp>r*   r+   z(%s) r,   )
r	   r
   r0   r1   r2   r   r3   r   replacer   )r   r4   r5   r6   r.   r-   r'   valuer   r   r   r7   Q   s   
zUrlReplacement.serializec                 C   r8   r9   r:   r=   r   r   r   rA   \   rB   zUrlReplacement.parseNrC   r   r   r   r   r   <   s
    N)
r"   zeepr   zeep.wsdl.messages.baser   r   __all__r   r   r   r   r   r   r   <module>   s    