%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/2318/lib/python3.8/xmlrpc/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/2318/lib/python3.8/xmlrpc/__pycache__/client.cpython-38.pyc

U

k�]e���
@sfdZddlZddlZddlZddlmZddlmZddlZddl	Z
ddlmZddl
Z
ddlmZzddlZWnek
r�dZYnXdd�Zd	ejdd
�ZdZdZd
ZdZdZdZdZd
ZdZdZdZdZ dZ!dZ"Gdd�de#�Z$Gdd�de$�Z%Gdd�de$�Z&Gdd�de$�Z'e(Z)Z*eddd�Z+e+�,d �d!k�rJd"d#�Z-n"e+�,d$�d!k�rdd%d#�Z-nd&d#�Z-[+d'd(�Z.Gd)d*�d*�Z/d+d,�Z0d-d.�Z1Gd/d0�d0�Z2d1d2�Z3e/e2fZ4Gd3d4�d4�Z5Gd5d6�d6�Z6Gd7d8�d8�Z7Gd9d:�d:�Z8Gd;d<�d<�Z9Gd=d>�d>�Z:dZ;Z<Z=dYd@dA�Z>dZdBdC�Z?d[dDdE�Z@dFdG�ZAd\dIdJ�ZBGdKdL�dLe�rXejCneD�ZEGdMdN�dN�ZFGdOdP�dP�ZGGdQdR�dReG�ZHGdSdT�dT�ZIeIZJeKdUk�rbeIdV�ZLzeMeLjN�O��Wn.e$k
�r�ZPzeMdWeP�W5dZP[PXYnXe:eL�ZQeQ�R�eQ�Sd
dX�eQ�Tdd
�zeQ�D]ZUeMeU��q Wn.e$k
�r`ZPzeMdWeP�W5dZP[PXYnXdS)]a�
An XML-RPC client interface for Python.

The marshalling and response parser code can also be used to
implement XML-RPC servers.

Exported exceptions:

  Error          Base class for client errors
  ProtocolError  Indicates an HTTP protocol error
  ResponseError  Indicates a broken response package
  Fault          Indicates an XML-RPC fault package

Exported classes:

  ServerProxy    Represents a logical connection to an XML-RPC server

  MultiCall      Executor of boxcared xmlrpc requests
  DateTime       dateTime wrapper for an ISO 8601 string or time tuple or
                 localtime integer value to generate a "dateTime.iso8601"
                 XML-RPC value
  Binary         binary data wrapper

  Marshaller     Generate an XML-RPC params chunk from a Python data structure
  Unmarshaller   Unmarshal an XML-RPC response from incoming XML event message
  Transport      Handles an HTTP transaction to an XML-RPC server
  SafeTransport  Handles an HTTPS transaction to an XML-RPC server

Exported constants:

  (none)

Exported functions:

  getparser      Create instance of the fastest available parser & attach
                 to an unmarshalling object
  dumps          Convert an argument tuple or a Fault instance to an XML-RPC
                 request (or response, if the methodresponse option is used).
  loads          Convert an XML-RPC packet to unmarshalled data plus a method
                 name (None if not present).
�N)�datetime)�Decimal)�expat)�BytesIOcCs$|�dd�}|�dd�}|�dd�S)N�&z&amp;�<z&lt;�>z&gt;)�replace)�s�r�#/usr/lib/python3.8/xmlrpc/client.py�escape�sr
z%d.%d�i���i�iD���i����i���ip���iԁ��iC���iB���i����i����i����c@seZdZdZejZdS)�ErrorzBase class for client errors.N)�__name__�
__module__�__qualname__�__doc__�object�__str__rrrrr�src@s eZdZdZdd�Zdd�ZdS)�
ProtocolErrorz!Indicates an HTTP protocol error.cCs&t�|�||_||_||_||_dS�N)r�__init__�url�errcode�errmsg�headers)�selfrrrrrrrr�s

zProtocolError.__init__cCsd|jj|j|j|jfS)Nz<%s for %s: %s %s>)�	__class__rrrr�rrrr�__repr__�s��zProtocolError.__repr__N�rrrrrr rrrrr�src@seZdZdZdS)�
ResponseErrorz$Indicates a broken response package.N)rrrrrrrrr"�sr"c@s eZdZdZdd�Zdd�ZdS)�Faultz#Indicates an XML-RPC fault package.cKst�|�||_||_dSr)rr�	faultCode�faultString)rr$r%Zextrarrrr�s
zFault.__init__cCsd|jj|j|jfS)Nz<%s %s: %r>)rrr$r%rrrrr �s�zFault.__repr__Nr!rrrrr#�sr#�z%YZ0001cCs
|�d�S�N�%Y%m%dT%H:%M:%S��strftime��valuerrr�_iso8601_formatsr-z%4YcCs
|�d�S)Nz%4Y%m%dT%H:%M:%Sr)r+rrrr-scCs|�d��d�S)Nr(�)r*�zfillr+rrrr-scCsLt|t�rt|�St|ttjf�s<|dkr2t��}t�|�}d|dd�S)Nrz%04d%02d%02dT%02d:%02d:%02d�)�
isinstancerr-�tuple�time�struct_time�	localtimer+rrr�	_strftimes

r6c@sreZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�DateTimez�DateTime wrapper for an ISO 8601 string or time tuple or
    localtime integer value to generate 'dateTime.iso8601' XML-RPC
    value.
    rcCs t|t�r||_n
t|�|_dSr)r1�strr,r6)rr,rrrr(s
zDateTime.__init__cCs�t|t�r|j}|j}nzt|t�r2|j}t|�}n`t|t�rH|j}|}nJt|d�rd|��}|��}n.t|d�rv|jj	p|t
|�}td|jj	|f��||fS)N�	timetuplerzCan't compare %s and %s)r1r7r,rr-r8�hasattrr9rr�type�	TypeError)r�otherr
�oZotyperrr�make_comparable.s*






��
�zDateTime.make_comparablecCs|�|�\}}||kSr�r?�rr=r
r>rrr�__lt__CszDateTime.__lt__cCs|�|�\}}||kSrr@rArrr�__le__GszDateTime.__le__cCs|�|�\}}||kSrr@rArrr�__gt__KszDateTime.__gt__cCs|�|�\}}||kSrr@rArrr�__ge__OszDateTime.__ge__cCs|�|�\}}||kSrr@rArrr�__eq__SszDateTime.__eq__cCst�|jd�Sr')r3�strptimer,rrrrr9WszDateTime.timetuplecCs|jSrr+rrrrr_szDateTime.__str__cCsd|jj|jt|�fS)Nz<%s %r at %#x>)rrr,�idrrrrr bszDateTime.__repr__cCst|���|_dSr)r8�stripr,�r�datarrr�decodeeszDateTime.decodecCs$|�d�|�|j�|�d�dS�Nz<value><dateTime.iso8601>z</dateTime.iso8601></value>
)�writer,)r�outrrr�encodehs
zDateTime.encodeN)r)rrrrrr?rBrCrDrErFr9rr rLrPrrrrr7"s
r7cCst�}|�|�|Sr)r7rL�rKr,rrr�	_datetimems
rRcCst�|d�Sr')rrG)rKrrr�_datetime_typessrSc@s:eZdZdZd
dd�Zdd�Zdd�Zd	d
�Zdd�ZdS)�BinaryzWrapper for binary data.NcCs>|dkrd}n&t|ttf�s,td|jj��t|�}||_dS)N�z#expected bytes or bytearray, not %s)r1�bytes�	bytearrayr<rrrKrJrrrrs�zBinary.__init__cCst|jd�S)Nzlatin-1)r8rKrrrrr�szBinary.__str__cCst|t�r|j}|j|kSr)r1rTrK)rr=rrrrF�s
z
Binary.__eq__cCst�|�|_dSr)�base64�decodebytesrKrJrrrrL�sz
Binary.decodecCs4|�d�t�|j�}|�|�d��|�d�dS�Nz<value><base64>
�asciiz</base64></value>
)rNrX�encodebytesrKrL)rrO�encodedrrrrP�s
z
Binary.encode)N)	rrrrrrrFrLrPrrrrrT|s
rTcCst�}|�|�|Sr)rTrLrQrrr�_binary�s
r^c@s$eZdZdd�Zdd�Zdd�ZdS)�ExpatParsercCsDt�dd�|_}||_|j|_|j|_|j|_	d}|�
|d�dSr)rZParserCreate�_parser�_target�startZStartElementHandler�endZEndElementHandlerrKZCharacterDataHandler�xml)r�target�parser�encodingrrrr�szExpatParser.__init__cCs|j�|d�dS�Nr)r`�ParserJrrr�feed�szExpatParser.feedcCs8z
|j}Wntk
rYnX|`|`|�dd�dS)NrUT)r`�AttributeErrorrari)rrfrrr�close�s
zExpatParser.closeN)rrrrrjrlrrrrr_�s	r_c@s�eZdZdZddd�ZiZdd�Zdd	�Zd
d�Zeee	d�<dd
�Z
e
ee<dd�Zeee
<eZdd�Zeee<efdd�Zeee<dd�Zeee<eee<dd�Zeee<eee<efdd�Zeee<dd�Zeee<dd�Zeee<eee <eed<dS) �
MarshalleravGenerate an XML-RPC params chunk from a Python data structure.

    Create a Marshaller instance for each set of parameters, and use
    the "dumps" method to convert your data (represented as a tuple)
    to an XML-RPC params chunk.  To write a fault response, pass a
    Fault instance instead.  You may prefer to use the "dumps" module
    function for this purpose.
    NFcCsi|_d|_||_||_dSr)�memorKrg�
allow_none)rrgrorrrr�szMarshaller.__init__cCs�g}|j}|j}t|t�r@|d�||j|jd�|�|d�n4|d�|D]}|d�|||�|d�qL|d�d�|�}|S)	Nz<fault>
)r$r%z	</fault>
z	<params>
z<param>
z	</param>
z
</params>
�)�append�_Marshaller__dumpr1r#r$r%�join)r�valuesrOrN�dump�v�resultrrr�dumps�s&
��



zMarshaller.dumpscCs�z|jt|�}Wnftk
rxt|d�s<tdt|���t|�jD]"}||j��krFtdt|���qF|jd}YnX||||�dS)N�__dict__zcannot marshal %s objects�_arbitrary_instance)�dispatchr;�KeyErrorr:r<�__mro__�keys)rr,rN�fZtype_rrrZ__dump�s
zMarshaller.__dumpcCs|jstd��|d�dS)Nz0cannot marshal None unless allow_none is enabledz<value><nil/></value>)ror<�rr,rNrrr�dump_nil
szMarshaller.dump_nilcCs$|d�||rdpd�|d�dS)Nz<value><boolean>�1�0z</boolean></value>
rr�rrr�	dump_boolszMarshaller.dump_boolcCs<|tks|tkrtd��|d�|tt|���|d�dS)Nzint exceeds XML-RPC limitsz<value><int>z</int></value>
)�MAXINT�MININT�
OverflowErrorr8�intr�rrr�	dump_longs
zMarshaller.dump_longcCs |d�|t|��|d�dS)Nz<value><double>z</double></value>
)�reprr�rrr�dump_double$szMarshaller.dump_doublecCs |d�|||��|d�dS)Nz<value><string>z</string></value>
r)rr,rNr
rrr�dump_unicode*szMarshaller.dump_unicodecCs,|d�t�|�}||�d��|d�dSrZ)rXr\rL)rr,rNr]rrr�
dump_bytes0s
zMarshaller.dump_bytescCsZt|�}||jkrtd��d|j|<|j}|d�|D]}|||�q6|d�|j|=dS)Nz"cannot marshal recursive sequencesz<value><array><data>
z</data></array></value>
)rHrnr<rr)rr,rN�irurvrrr�
dump_array8s

zMarshaller.dump_arraycCs�t|�}||jkrtd��d|j|<|j}|d�|��D]D\}}|d�t|t�s\td��|d||��|||�|d�q:|d�|j|=dS)Nz%cannot marshal recursive dictionariesz<value><struct>
z	<member>
zdictionary key must be stringz<name>%s</name>
z
</member>
z</struct></value>
)rHrnr<rr�itemsr1r8)rr,rNr
r�ru�krvrrr�dump_structFs




zMarshaller.dump_structcCs |d�|t|��|d�dSrM)r6r�rrr�
dump_datetimeXszMarshaller.dump_datetimecCs2|jtkr ||_|�|�|`n|�|j|�dSr)r�WRAPPERSrNrPr�ryr�rrr�
dump_instance^s


zMarshaller.dump_instancerz)NF)!rrrrrr{rxrrr�r;r��boolr�r�Zdump_intr��floatr
r�r8r�rVrWr�r2�listr��dictr�rr�r7rTrrrrrm�s<
	rmc@sneZdZdZdEdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZiZdd�Z
e
ed<dd�Zeed<dd�Zeed<eed<eed<eed<eed<eed <d!d"�Zeed#<eed$<d%d&�Zeed'<d(d)�Zeed*<eed+<d,d-�Zeed.<d/d0�Zeed1<d2d3�Zeed4<d5d6�Zeed7<d8d9�Zeed:<d;d<�Zeed=<d>d?�Zeed@<dAdB�ZeedC<dDS)F�UnmarshalleraUnmarshal an XML-RPC response, based on incoming XML event
    messages (start, data, end).  Call close() to get the resulting
    data structure.

    Note that this reader is fairly tolerant, and gladly accepts bogus
    XML-RPC data without complaining (but not bogus XML).
    FcCsHd|_g|_g|_g|_d|_d|_d|_|jj|_|p:||_||_	dS)NF�utf-8)
�_type�_stack�_marks�_data�_value�_methodname�	_encodingrq�
_use_datetime�
_use_bytes)r�use_datetime�use_builtin_typesrrrr~s

zUnmarshaller.__init__cCs:|jdks|jrt��|jdkr0tf|jd��t|j�S)N�faultr)r�r�r"r#r�r2rrrrrl�s

zUnmarshaller.closecCs|jSr)r�rrrr�
getmethodname�szUnmarshaller.getmethodnamecCs
||_dSr)r�)rrgZ
standalonerrrrd�szUnmarshaller.xmlcCshd|kr|�d�d}|dks&|dkr8|j�t|j��g|_|jrZ||jkrZtd|��|dk|_dS)N�:����array�structzunknown tag %rr,)	�splitr�rq�lenr�r�r�r{r")r�tagZattrsrrrrb�szUnmarshaller.startcCs|j�|�dSr)r�rq)r�textrrrrK�szUnmarshaller.datacCsvz|j|}WnTtk
rbd|kr,YdSz|j|�d�d}Wntk
r\YYdSXYnX||d�|j��S)Nr�r�rp)r{r|r�rsr�)rr�rrrrrc�szUnmarshaller.endcCsnz|j|}WnTtk
rbd|kr,YdSz|j|�d�d}Wntk
r\YYdSXYnX|||�S)Nr�r�)r{r|r�)rr�rKrrrr�end_dispatch�szUnmarshaller.end_dispatchcCs|�d�d|_dSrh)rqr�rJrrr�end_nil�s
zUnmarshaller.end_nilZnilcCs:|dkr|�d�n|dkr(|�d�ntd��d|_dS)Nr�Fr�Tzbad boolean valuer)rqr<r�rJrrr�end_boolean�szUnmarshaller.end_boolean�booleancCs|�t|��d|_dSrh)rqr�r�rJrrr�end_int�szUnmarshaller.end_intZi1Zi2Zi4Zi8r�Z
bigintegercCs|�t|��d|_dSrh)rqr�r�rJrrr�
end_double�szUnmarshaller.end_doubleZdoubler�cCs|�t|��d|_dSrh)rqrr�rJrrr�end_bigdecimal�szUnmarshaller.end_bigdecimalZ
bigdecimalcCs&|jr|�|j�}|�|�d|_dSrh)r�rLrqr�rJrrr�
end_string�s
zUnmarshaller.end_string�string�namecCs.|j��}|j|d�g|j|d�<d|_dSrh)r��popr�r�)rrK�markrrr�	end_array�s
zUnmarshaller.end_arrayr�cCs`|j��}i}|j|d�}tdt|�d�D]}||d|||<q,|g|j|d�<d|_dS)Nrrr&)r�r�r��ranger�r�)rrKr�r�r�r�rrr�
end_struct�s
zUnmarshaller.end_structr�cCs6t�}|�|�d��|jr"|j}|�|�d|_dS)Nr[r)rTrLrPr�rKrqr��rrKr,rrr�
end_base64
s
zUnmarshaller.end_base64rXcCs,t�}|�|�|jrt|�}|�|�dSr)r7rLr�rSrqr�rrr�end_dateTimes

zUnmarshaller.end_dateTimezdateTime.iso8601cCs|jr|�|�dSr)r�r�rJrrr�	end_valueszUnmarshaller.end_valuer,cCs
d|_dS)N�params�r�rJrrr�
end_params"szUnmarshaller.end_paramsr�cCs
d|_dS)Nr�r�rJrrr�	end_fault&szUnmarshaller.end_faultr�cCs"|jr|�|j�}||_d|_dS)N�
methodName)r�rLr�r�rJrrr�end_methodName*szUnmarshaller.end_methodNamer�N)FF)rrrrrrlr�rdrbrKrcr�r{r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�rsZ
	r�c@s$eZdZdd�Zdd�Zdd�ZdS)�_MultiCallMethodcCs||_||_dSr)�_MultiCallMethod__call_list�_MultiCallMethod__name)rZ	call_listr�rrrr7sz_MultiCallMethod.__init__cCst|jd|j|f�S�Nz%s.%s)r�r�r��rr�rrr�__getattr__:sz_MultiCallMethod.__getattr__cGs|j�|j|f�dSr)r�rqr��r�argsrrr�__call__<sz_MultiCallMethod.__call__N�rrrrr�r�rrrrr�4sr�c@s eZdZdZdd�Zdd�ZdS)�MultiCallIteratorzaIterates over the results of a multicall. Exceptions are
    raised in response to xmlrpc faults.cCs
||_dSr)�results)rr�rrrrCszMultiCallIterator.__init__cCsR|j|}t|�ti�kr.t|d|d��n t|�tg�krF|dStd��dS)Nr$r%rz#unexpected type in multicall result)r�r;r#�
ValueError)rr��itemrrr�__getitem__Fs
zMultiCallIterator.__getitem__N)rrrrrr�rrrrr�?sr�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�	MultiCalla~server -> an object used to boxcar method calls

    server should be a ServerProxy object.

    Methods can be added to the MultiCall using normal
    method call syntax e.g.:

    multicall = MultiCall(server_proxy)
    multicall.add(2,3)
    multicall.get_address("Guido")

    To execute the multicall, call the MultiCall object e.g.:

    add_result, address = multicall()
    cCs||_g|_dSr)�_MultiCall__server�_MultiCall__call_list)r�serverrrrr`szMultiCall.__init__cCsd|jjt|�fS)Nz<%s at %#x>)rrrHrrrrr dszMultiCall.__repr__cCst|j|�Sr)r�r�r�rrrr�gszMultiCall.__getattr__cCs6g}|jD]\}}|�||d��q
t|jj�|��S)N)r�r�)r�rqr�r��systemZ	multicall)rZmarshalled_listr�r�rrrr�jszMultiCall.__call__N)rrrrrr r�r�rrrrr�Os
r�FcCsrtrHtrH|rt}tj}n|r&t}t}nt}t}tdd||t�}t|�}n"t||d�}trbt|�}nt	|�}||fS)z�getparser() -> parser, unmarshaller

    Create an instance of the fastest available parser, and attach it
    to an unmarshalling object.  Return both objects.
    TF�r�r�)
�
FastParser�FastUnmarshallerrSrXrYr^rRr#r�r_)r�r�Z
mkdatetimeZmkbytesrerfrrr�	getparser|s 

r�cCs�t|ttf�std��t|t�r&d}n"|rHt|t�rHt|�dksHtd��|sPd}tr^t|�}n
t||�}|�|�}|dkr�dt|�}nd}|r�|d|d|d	f}n|r�|d
|df}n|Sd�	|�S)
a�data [,options] -> marshalled data

    Convert an argument tuple or a Fault instance to an XML-RPC
    request (or response, if the methodresponse option is used).

    In addition to the data object, the following options can be given
    as keyword arguments:

        methodname: the method name for a methodCall packet

        methodresponse: true to create a methodResponse packet.
        If this option is used with a tuple, the tuple must be
        a singleton (i.e. it can contain only one element).

        encoding: the packet encoding (default is UTF-8)

    All byte strings in the data structure are assumed to use the
    packet encoding.  Unicode strings are automatically converted,
    where necessary.
    z(argument must be tuple or Fault instancer&z"response tuple must be a singletonr�z$<?xml version='1.0' encoding='%s'?>
z<?xml version='1.0'?>
z<methodCall>
<methodName>z</methodName>
z</methodCall>
z<methodResponse>
z</methodResponse>
rp)
r1r2r#�AssertionErrorr��FastMarshallerrmrxr8rs)r��
methodnameZmethodresponsergro�mrKZ	xmlheaderrrrrx�s<



��rxcCs2t||d�\}}|�|�|��|��|��fS)z�data -> unmarshalled data, method name

    Convert an XML-RPC packet to unmarshalled data plus a method
    name (None if not present).

    If the XML-RPC packet represents a fault condition, this function
    raises a Fault exception.
    r�)r�rjrlr�)rKr�r��p�urrr�loads�s	
r�c	Cs<tst�t�}tjd|dd��}|�|�W5QRX|��S)zhdata -> gzip encoded data

    Encode data using the gzip content encoding as described in RFC 1952
    �wbr&)�mode�fileobjZ
compresslevel)�gzip�NotImplementedErrorr�GzipFilerN�getvalue)rKr�gzfrrr�gzip_encodesr��@c	Cs�tst�tjdt|�d��H}z$|dkr0|��}n|�|d�}Wntk
r\td��YnXW5QRX|dkr�t|�|kr�td��|S)zrgzip encoded data -> unencoded data

    Decode data using the gzip content encoding as described in RFC 1952
    �rb�r�r�rr&zinvalid dataz#max gzipped payload length exceeded)r�r�r�r�read�OSErrorr�r�)rKZ
max_decoder�Zdecodedrrr�gzip_decodes
r�c@s eZdZdZdd�Zdd�ZdS)�GzipDecodedResponsezha file-like object to decode a response encoded with the gzip
    method, as described in RFC 1952.
    cCs.tst�t|���|_tjj|d|jd�dS)Nr�r�)r�r�rr��ior�r)r�responserrrr:szGzipDecodedResponse.__init__cCs"ztj�|�W5|j��XdSr)r�rlr�r�rrrrrlBszGzipDecodedResponse.closeN)rrrrrrlrrrrr�6sr�c@s$eZdZdd�Zdd�Zdd�ZdS)�_MethodcCs||_||_dSr��
_Method__send�
_Method__name)r�sendr�rrrrOsz_Method.__init__cCst|jd|j|f�Sr�)r�r�r�r�rrrr�Rsz_Method.__getattr__cGs|�|j|�Srr�r�rrrr�Tsz_Method.__call__Nr�rrrrr�Lsr�c@s�eZdZdZdeZdZdZddd�dd	�Zdd
d�Z	d dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)!�	Transportz1Handles an HTTP transaction to an XML-RPC server.zPython-xmlrpc/%sTNFr)rcCs&||_||_d|_t|�|_g|_dS�N)NN)r��_use_builtin_types�_connectionr��_headers�_extra_headers)rr�r�rrrrrks

zTransport.__init__cCs�dD]v}z|�||||�WStjjk
r<|r8�Yqtk
rx}z |sf|jtjtjtjfkrh�W5d}~XYqXqdS)N)rr&)	�single_request�http�clientZRemoteDisconnectedr��errnoZ
ECONNRESETZECONNABORTEDZEPIPE)r�host�handler�request_body�verboser��errr�request}s�zTransport.requestcCs�z8|�||||�}|��}|jdkr6||_|�|�WSWn2tk
rN�Yntk
rj|���YnX|�dd�r�|�	�t
|||j|jt|�
����dS)N��zcontent-lengthrp)�send_requestZgetresponseZstatusr
�parse_responser#�	Exceptionrl�	getheaderr�r�reasonr�Z
getheaders)rr
rrr
Z	http_connZresprrrr�s&

�zTransport.single_requestcCst|j|jd�S)Nr�)r�r�rrrrrr��s�zTransport.getparsercCsri}t|t�r|\}}tj�|�\}}|rdtj�|�}t�|��d�}d�	|�
��}dd|fg}ng}|||fS)Nr�rpZ
AuthorizationzBasic )r1r2�urllib�parseZ
_splituserZunquote_to_bytesrXr\rLrsr�)rr
�x509ZauthZ
extra_headersrrr�
get_host_info�s

�zTransport.get_host_infocCsL|jr||jdkr|jdS|�|�\}|_}|tj�|�f|_|jdS)Nrr&)rrrrrZHTTPConnection�rr
Zchostrrrr�make_connection�s

zTransport.make_connectioncCs |j\}}|rd|_|��dSr)rrl)rr
�
connectionrrrrl�s
zTransport.closecCs�|�|�}|j|j}|r$|�d�|jrJtrJ|jd|dd�|�d�n|�d|�|�d�|�d|jf�|�	||�|�
||�|S)Nr&ZPOSTT)Zskip_accept_encoding)zAccept-Encodingr�)zContent-Typeztext/xmlz
User-Agent)rrrZset_debuglevel�accept_gzip_encodingr�Z
putrequestrq�
user_agent�send_headers�send_content)rr
rr�debugrrrrrr�s



zTransport.send_requestcCs|D]\}}|�||�qdSr)�	putheader)rrr�key�valrrrrszTransport.send_headerscCsR|jdk	r0|jt|�kr0tr0|�dd�t|�}|�dtt|���|�|�dS)N�Content-Encodingr�zContent-Length)�encode_thresholdr�r�r"r�r8Z
endheaders)rrrrrrr s
��zTransport.send_contentcCs�t|d�r*|�dd�dkr$t|�}q.|}n|}|��\}}|�d�}|sJqj|jr^tdt|��|�|�q:||k	rz|�	�|�	�|�	�S)Nrr%rpr�izbody:)
r:rr�r�r�r
�printr�rjrl)rr��streamr�r�rKrrrr$s 


zTransport.parse_response)FF)F)F)rrrr�__version__rrr&rrrr�rrrlrrr rrrrrr]s"�

!rcs2eZdZdZd
ddd��fdd�Zdd	�Z�ZS)�
SafeTransportz2Handles an HTTPS transaction to an XML-RPC server.FrN�r�contextcst�j|||d�||_dS)N�r�r�r)�superrr,)rr�r�rr,�rrrrEs
�zSafeTransport.__init__cCst|jr||jdkr|jdSttjd�s2td��|�|�\}|_}|tjj|dfd|ji|p`i��f|_|jdS)Nrr&�HTTPSConnectionz1your version of http.client doesn't support HTTPSr,)	rr:rrr�rrr0r,rrrrrNs
�
���
zSafeTransport.make_connection)FF)rrrrrr�
__classcell__rrr/rr*Bs�	r*c@sZeZdZdZdddd�dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�ZdS)�ServerProxya�uri [,options] -> a logical connection to an XML-RPC server

    uri is the connection point on the server, given as
    scheme://host/target.

    The standard implementation always supports the "http" scheme.  If
    SSL socket support is available (Python 2.0), it also supports
    "https".

    If the target part and the slash preceding it are both omitted,
    "/RPC2" is assumed.

    The following options can be given as keyword arguments:

        transport: a transport factory
        encoding: the request encoding (default is UTF-8)

    All 8-bit strings passed to the server proxy are assumed to use
    the given encoding.
    NFrr+c
Cs�tj�|�\}
}|
dkr td��tj�|�\|_|_|js@d|_|dkr||
dkr^t}d|	i}nt}i}|f|||d�|��}||_	|p�d|_
||_||_dS)N)r�httpszunsupported XML-RPC protocolz/RPC2r3r,r-r�)
rrZ
_splittyper�Z
_splithost�_ServerProxy__host�_ServerProxy__handlerr*r�_ServerProxy__transport�_ServerProxy__encoding�_ServerProxy__verbose�_ServerProxy__allow_none)
rZuri�	transportrgr
ror�r�rr,r;rZextra_kwargsrrrr�s,
��
zServerProxy.__init__cCs|j��dSr)r6rlrrrrZ__close�szServerProxy.__closecCsPt|||j|jd��|jd�}|jj|j|j||jd�}t	|�dkrL|d}|S)N)rgro�xmlcharrefreplace)r
r&r)
rxr7r9rPr6rr4r5r8r�)rr�r�rr�rrrZ	__request�s
���zServerProxy.__requestcCsd|jj|j|jfS)Nz
<%s for %s%s>)rrr4r5rrrrr �s��zServerProxy.__repr__cCst|j|�Sr)r��_ServerProxy__requestr�rrrr��szServerProxy.__getattr__cCs.|dkr|jS|dkr|jStd|f��dS)z|A workaround to get special attributes on the ServerProxy
           without interfering with the magic __getattr__
        rlr:zAttribute %r not foundN)�_ServerProxy__closer6rk)r�attrrrrr��s
zServerProxy.__call__cCs|Srrrrrr�	__enter__�szServerProxy.__enter__cGs|��dSr)r=r�rrr�__exit__�szServerProxy.__exit__)NNFFFF)rrrrrr=r<r r�r�r?r@rrrrr2ms ��
r2�__main__zhttp://localhost:8000ZERROR�	)FF)NNNF)FF)r�)VrrX�sysr3rZdecimalrZhttp.clientrZurllib.parserZxml.parsersrr	r�rr��ImportErrorr
�version_infor)r�r�ZPARSE_ERRORZSERVER_ERRORZAPPLICATION_ERRORZSYSTEM_ERRORZTRANSPORT_ERRORZNOT_WELLFORMED_ERRORZUNSUPPORTED_ENCODINGZINVALID_ENCODING_CHARZINVALID_XMLRPCZMETHOD_NOT_FOUNDZINVALID_METHOD_PARAMSZINTERNAL_ERRORrrrr"r#r�r�ZBooleanZ_day0r*r-r6r7rRrSrTr^r�r_rmr�r�r�r�r�r�r�r�rxr�r�r�r�rr�r�rr*r2ZServerrr�r'ZcurrentTimeZgetCurrentTimervZmultiZgetData�pow�addr�rrrr�<module>Ys�*



K	#!(C%
'�
K

f+h



Zerion Mini Shell 1.0