Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib/python3.7/site-packages/future/backports/xmlrpc/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/future/backports/xmlrpc/__pycache__/client.cpython-37.pyc

B

�A�[��
@s�dZddlmZmZmZmZddlmZmZm	Z	m
Z
mZddlZej
e_eje_ddlZddlZddlmZddlmZddlmZddlmZdd	lmZddlZddlZdd
l m!Z!yddl"Z"Wne#k
r�dZ"YnXdd�Z$ej%dd
�Z&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4Gdd�de5�Z6Gdd�de6�Z7Gdd�de6�Z8Gd d!�d!e6�Z9e:Z;Z<d"d#�Z=d$d%�Z>Gd&d'�d'e?�Z@d(d)�ZAd*d+�ZBGd,d-�d-e?�ZCd.d/�ZDe@eCfZEGd0d1�d1e?�ZFGd2d3�d3e?�ZGGd4d5�d5e?�ZHGd6d7�d7e?�ZIGd8d9�d9e?�ZJGd:d;�d;e?�ZKdZLZMZNdWd=d>�ZOdXd?d@�ZPdYdAdB�ZQdCdD�ZRdEdF�ZSGdGdH�dHe"�rte"jTne?�ZUGdIdJ�dJe?�ZVGdKdL�dLe?�ZWGdMdN�dNeW�ZXGdOdP�dPe?�ZYeYZZe[dQk�r�eYdR�Z\ye]e\j^�_��Wn.e6k
�rZ`ze]dSe`�WddZ`[`XYnXeKe\�Zaea�b�ea�cdTdU�ea�ddVdT�yxea�D]Zee]ee��qDWWn.e6k
�r�Z`ze]dSe`�WddZ`[`XYnXdS)Za�
Ported using Python-Future from the Python 3.3 standard library.

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).
�)�absolute_import�division�print_function�unicode_literals)�bytes�dict�int�range�strN)�datetime)�client)�parse)�ensure_new_type)�expat)�BytesIOcCs$|�dd�}|�dd�}|�dd�S)N�&z&amp;�<z&lt;�>z&gt;)�replace)�s�r�O/opt/alt/python37/lib/python3.7/site-packages/future/backports/xmlrpc/client.py�escape�sr�i���i�iD���i����i���ip���iԁ��iC���iB���i����i����i����c@seZdZdZdd�ZdS)�ErrorzBase class for client errors.cCst|�S)N)�repr)�selfrrr�__str__�sz
Error.__str__N)�__name__�
__module__�__qualname__�__doc__rrrrrr�src@s eZdZdZdd�Zdd�ZdS)�
ProtocolErrorz!Indicates an HTTP protocol error.cCs&t�|�||_||_||_||_dS)N)r�__init__�url�errcode�errmsg�headers)rr$r%r&r'rrrr#�s

zProtocolError.__init__cCsd|j|j|jfS)Nz<ProtocolError for %s: %s %s>)r$r%r&)rrrr�__repr__�szProtocolError.__repr__N)rrr r!r#r(rrrrr"�sr"c@seZdZdZdS)�
ResponseErrorz$Indicates a broken response package.N)rrr r!rrrrr)�sr)c@s eZdZdZdd�Zdd�ZdS)�Faultz#Indicates an XML-RPC fault package.cKst�|�||_||_dS)N)rr#�	faultCode�faultString)rr+r,�extrarrrr#�s
zFault.__init__cCsdt|j�t|j�fS)Nz<Fault %s: %r>)rr+r,)rrrrr(�s
zFault.__repr__N)rrr r!r#r(rrrrr*�sr*cCs d|j|j|j|j|j|jfS)Nz%04d%02d%02dT%02d:%02d:%02d)�year�month�day�hour�minute�second)�valuerrr�_iso8601_formatsr5cCsLt|t�rt|�St|ttjf�s<|dkr2t��}t�|�}d|dd�S)Nrz%04d%02d%02dT%02d:%02d:%02d�)�
isinstancerr5�tuple�time�struct_time�	localtime)r4rrr�	_strftime's

r<c@szeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�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|�|_dS)N)r7r
r4r<)rr4rrrr#8s
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�	timetuple�	__class__zCan't compare %s and %s)r7r=r4rr5r
�hasattrr>r?r�type�	TypeError)r�otherr�oZotyperrr�make_comparable>s$






zDateTime.make_comparablecCs|�|�\}}||kS)N)rE)rrCrrDrrr�__lt__SszDateTime.__lt__cCs|�|�\}}||kS)N)rE)rrCrrDrrr�__le__WszDateTime.__le__cCs|�|�\}}||kS)N)rE)rrCrrDrrr�__gt__[szDateTime.__gt__cCs|�|�\}}||kS)N)rE)rrCrrDrrr�__ge___szDateTime.__ge__cCs|�|�\}}||kS)N)rE)rrCrrDrrr�__eq__cszDateTime.__eq__cCs|�|�\}}||kS)N)rE)rrCrrDrrr�__ne__gszDateTime.__ne__cCst�|jd�S)Nz%Y%m%dT%H:%M:%S)r9�strptimer4)rrrrr>kszDateTime.timetuplecCs|jS)N)r4)rrrrrsszDateTime.__str__cCsdt|j�t|�fS)Nz<DateTime %r at %x>)rr4�id)rrrrr(vszDateTime.__repr__cCst|���|_dS)N)r
�stripr4)r�datarrr�decodeyszDateTime.decodecCs$|�d�|�|j�|�d�dS)Nz<value><dateTime.iso8601>z</dateTime.iso8601></value>
)�writer4)r�outrrr�encode|s
zDateTime.encodeN)r)rrr r!r#rErFrGrHrIrJrKr>rr(rPrSrrrrr=2s
r=cCst�}|�|�|S)N)r=rP)rOr4rrr�	_datetime�s
rTcCst�|d�S)Nz%Y%m%dT%H:%M:%S)rrL)rOrrr�_datetime_type�srUc@sBeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�BinaryzWrapper for binary data.NcCs>|dkrd}n&t|ttf�s,td|jj��t|�}||_dS)N�z#expected bytes or bytearray, not %s)r7r�	bytearrayrBr?rrO)rrOrrrr#�szBinary.__init__cCst|jd�S)Nzlatin-1)r
rO)rrrrr�szBinary.__str__cCst|t�r|j}|j|kS)N)r7rVrO)rrCrrrrJ�s
z
Binary.__eq__cCst|t�r|j}|j|kS)N)r7rVrO)rrCrrrrK�s
z
Binary.__ne__cCst�|�|_dS)N)�base64�decodebytesrO)rrOrrrrP�sz
Binary.decodecCs4|�d�t�|j�}|�|�d��|�d�dS)Nz<value><base64>
�asciiz</base64></value>
)rQrY�encodebytesrOrP)rrR�encodedrrrrS�s
z
Binary.encode)N)
rrr r!r#rrJrKrPrSrrrrrV�s
rVcCst�}|�|�|S)N)rVrP)rOr4rrr�_binary�s
r^c@s$eZdZdd�Zdd�Zdd�ZdS)�ExpatParsercCsDt�dd�|_}||_|j|_|j|_|j|_	d}|�
|d�dS)N)r�ParserCreate�_parser�_target�start�StartElementHandler�end�EndElementHandlerrO�CharacterDataHandler�xml)r�target�parser�encodingrrrr#�szExpatParser.__init__cCs|j�|d�dS)Nr)ra�Parse)rrOrrr�feed�szExpatParser.feedcCs|j�dd�|`|`dS)N��)rarlrb)rrrr�close�szExpatParser.closeN)rrr r#rmrprrrrr_�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|_||_||_dS)N)�memorOrk�
allow_none)rrkrsrrrr#�szMarshaller.__init__cCs�g}|j}|j}t|t�r@|d�||j|jd�|�|d�n8|d�x&|D]}|d�|||�|d�qNW|d�d�|�}t|�S)	Nz<fault>
)r+r,z	</fault>
z	<params>
z<param>
z	</param>
z
</params>
rn)�append�_Marshaller__dumpr7r*r+r,�joinr
)r�valuesrRrQ�dump�v�resultrrr�dumps�s"




zMarshaller.dumpscCs�y|jtt|��}Wnjtk
r�t|d�s@tdt|���x0t|�jD]"}||j��krLtdt|���qLW|jd}YnX||||�dS)N�__dict__zcannot marshal %s objects�_arbitrary_instance)�dispatchrAr�KeyErrorr@rB�__mro__�keys)rr4rQ�f�type_rrrZ__dumps
zMarshaller.__dumpcCs|jstd��|d�dS)Nz0cannot marshal None unless allow_none is enabledz<value><nil/></value>)rsrB)rr4rQrrr�dump_nil!szMarshaller.dump_nilcCs$|d�||rdpd�|d�dS)Nz<value><boolean>�1�0z</boolean></value>
r)rr4rQrrr�	dump_bool'szMarshaller.dump_boolcCs<|tks|tkrtd��|d�|tt|���|d�dS)Nzlong int exceeds XML-RPC limitsz<value><int>z</int></value>
)�MAXINT�MININT�
OverflowErrorr
r)rr4rQrrr�	dump_long-s
zMarshaller.dump_longcCs$|d�|tt|���|d�dS)Nz<value><double>z</double></value>
)rr)rr4rQrrr�dump_double8szMarshaller.dump_doublecCs |d�|||��|d�dS)Nz<value><string>z</string></value>
r)rr4rQrrrr�dump_unicode>szMarshaller.dump_unicodecCs,|d�t�|�}||�d��|d�dS)Nz<value><base64>
r[z</base64></value>
)rYr\rP)rr4rQr]rrr�
dump_bytesDs
zMarshaller.dump_bytescCs^t|�}||jkrtd��d|j|<|j}|d�x|D]}|||�q8W|d�|j|=dS)Nz"cannot marshal recursive sequencesz<value><array><data>
z</data></array></value>
)rMrrrBru)rr4rQ�irxryrrr�
dump_arrayLs


zMarshaller.dump_arraycCs�t|�}||jkrtd��d|j|<|j}|d�xP|��D]D\}}|d�t|t�s^td��|d||��|||�|d�q<W|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>
)rMrrrBru�itemsr7r
)rr4rQrr�rx�kryrrr�dump_structZs



zMarshaller.dump_structcCs |d�|t|��|d�dS)Nz<value><dateTime.iso8601>z</dateTime.iso8601></value>
)r<)rr4rQrrr�
dump_datetimelszMarshaller.dump_datetimecCs2|jtkr ||_|�|�|`n|�|j|�dS)N)r?�WRAPPERSrQrSr�r|)rr4rQrrr�
dump_instancers


zMarshaller.dump_instancer})NF)!rrr r!r#r~r{rur�rAr��boolr�rZdump_intr��floatrr�r
r�rrXr�r8�listr�rr�rr�r=rVrrrrrq�s<
	rqc@s>eZdZdZd>dd�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<dd�Zeed <d!d"�Zeed#<eed$<d%d&�Zeed'<d(d)�Zeed*<d+d,�Zeed-<d.d/�Zeed0<d1d2�Zeed3<d4d5�Zeed6<d7d8�Zeed9<d:d;�Zeed<<d=S)?�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).
    FcCsBd|_g|_g|_g|_d|_d|_|jj|_|p4||_||_dS)Nzutf-8)	�_type�_stack�_marks�_data�_methodname�	_encodingrt�
_use_datetime�
_use_bytes)r�use_datetime�use_builtin_typesrrrr#�s

zUnmarshaller.__init__cCs:|jdks|jrt��|jdkr0tf|jd��t|j�S)N�faultr)r�r�r)r*r�r8)rrrrrp�s

zUnmarshaller.closecCs|jS)N)r�)rrrr�
getmethodname�szUnmarshaller.getmethodnamecCs
||_dS)N)r�)rrkZ
standalonerrrrh�szUnmarshaller.xmlcCs6|dks|dkr"|j�t|j��g|_|dk|_dS)N�array�structr4)r�rt�lenr�r��_value)r�tag�attrsrrrrc�szUnmarshaller.startcCs|j�|�dS)N)r�rt)r�textrrrrO�szUnmarshaller.datacCs:y|j|}Wntk
r"YnX||d�|j��SdS)Nrn)r~rrvr�)rr�r�rrrre�s
zUnmarshaller.endcCs2y|j|}Wntk
r"YnX|||�SdS)N)r~r)rr�rOr�rrr�end_dispatch�s
zUnmarshaller.end_dispatchcCs|�d�d|_dS)Nr)rtr�)rrOrrr�end_nil�s
zUnmarshaller.end_nilZnilcCs:|dkr|�d�n|dkr(|�d�ntd��d|_dS)Nr�Fr�Tzbad boolean valuer)rtrBr�)rrOrrr�end_boolean�szUnmarshaller.end_boolean�booleancCs|�t|��d|_dS)Nr)rtrr�)rrOrrr�end_int�szUnmarshaller.end_intZi4Zi8rcCs|�t|��d|_dS)Nr)rtr�r�)rrOrrr�
end_double�szUnmarshaller.end_doubleZdoublecCs&|jr|�|j�}|�|�d|_dS)Nr)r�rPrtr�)rrOrrr�
end_string�s
zUnmarshaller.end_string�string�namecCs.|j��}|j|d�g|j|d�<d|_dS)Nr)r��popr�r�)rrO�markrrr�	end_array�s
zUnmarshaller.end_arrayr�cCsd|j��}i}|j|d�}x,tdt|�d�D]}||d|||<q.W|g|j|d�<d|_dS)Nr�ro)r�r�r�r	r�r�)rrOr�rr�r�rrr�
end_struct�s
zUnmarshaller.end_structr�cCs6t�}|�|�d��|jr"|j}|�|�d|_dS)Nr[r)rVrPrSr�rOrtr�)rrOr4rrr�
end_base64s
zUnmarshaller.end_base64rYcCs,t�}|�|�|jrt|�}|�|�dS)N)r=rPr�rUrt)rrOr4rrr�end_dateTimes

zUnmarshaller.end_dateTimezdateTime.iso8601cCs|jr|�|�dS)N)r�r�)rrOrrr�	end_valueszUnmarshaller.end_valuer4cCs
d|_dS)N�params)r�)rrOrrr�
end_params szUnmarshaller.end_paramsr�cCs
d|_dS)Nr�)r�)rrOrrr�	end_fault$szUnmarshaller.end_faultr�cCs"|jr|�|j�}||_d|_dS)N�
methodName)r�rPr�r�)rrOrrr�end_methodName(szUnmarshaller.end_methodNamer�N)FF)rrr r!r#rpr�rhrcrOrer�r~r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��sN
	r�c@s$eZdZdd�Zdd�Zdd�ZdS)�_MultiCallMethodcCs||_||_dS)N)�_MultiCallMethod__call_list�_MultiCallMethod__name)rZ	call_listr�rrrr#5sz_MultiCallMethod.__init__cCst|jd|j|f�S)Nz%s.%s)r�r�r�)rr�rrr�__getattr__8sz_MultiCallMethod.__getattr__cGs|j�|j|f�dS)N)r�rtr�)r�argsrrr�__call__:sz_MultiCallMethod.__call__N)rrr r#r�r�rrrrr�2sr�c@s eZdZdZdd�Zdd�ZdS)�MultiCallIteratorzaIterates over the results of a multicall. Exceptions are
    raised in response to xmlrpc faults.cCs
||_dS)N)�results)rr�rrrr#AszMultiCallIterator.__init__cCsP|j|}tt|�t�r,t|d|d��n t|�tg�krD|dStd��dS)Nr+r,rz#unexpected type in multicall result)r�r7rArr*�
ValueError)rr��itemrrr�__getitem__Ds
zMultiCallIterator.__getitem__N)rrr r!r#r�rrrrr�=sr�c@s4eZdZdZdd�Zdd�ZeZdd�Zdd	�Zd
S)�	MultiCalla}server -> a 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|_dS)N)�_MultiCall__server�_MultiCall__call_list)r�serverrrrr#^szMultiCall.__init__cCsdt|�S)Nz<MultiCall at %x>)rM)rrrrr(bszMultiCall.__repr__cCst|j|�S)N)r�r�)rr�rrrr�gszMultiCall.__getattr__cCs:g}x"|jD]\}}|�||d��qWt|jj�|��S)N)r�r�)r�rtr�r��systemZ	multicall)rZmarshalled_listr�r�rrrr�jszMultiCall.__call__N)	rrr r!r#r(rr�r�rrrrr�Ms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�FastUnmarshallerrUrYrZr^rTr*r�r_)r�r�Z
mkdatetimeZmkbytesrirjrrr�	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�t|t�s�|�	|�}|d|d|d	f}n|r�|d
|df}n|Std��
|�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 instanceroz"response tuple must be a singletonzutf-8z$<?xml version='1.0' encoding='%s'?>
z<?xml version='1.0'?>
z<methodCall>
<methodName>z</methodName>
z</methodCall>
z<methodResponse>
z</methodResponse>
rn)r7r8r*�AssertionErrorr��FastMarshallerrqr{r
rSrv)r��
methodnameZmethodresponserkrs�mrOZ	xmlheaderrrrr{�s:





r{cCs2t||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�)r�rmrpr�)rOr�r��p�urrr�loads�s	
r�cCsDtst�t�}tjd|dd�}|�|�|��|��}|��|S)zhdata -> gzip encoded data

    Encode data using the gzip content encoding as described in RFC 1952
    �wbro)�mode�fileobj�
compresslevel)�gzip�NotImplementedErrorr�GzipFilerQrp�getvalue)rOr��gzfr]rrr�gzip_encodes
r�cCs\tst�t|�}tjd|d�}y|��}Wntk
rFtd��YnX|��|��|S)zrgzip encoded data -> unencoded data

    Decode data using the gzip content encoding as described in RFC 1952
    �rb)r�r�zinvalid data)r�r�rr��read�IOErrorr�rp)rOr�r��decodedrrr�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�r�rr��ior�r#)r�responserrrr#:szGzipDecodedResponse.__init__cCstj�|�|j��dS)N)r�r�rpr�)rrrrrpBszGzipDecodedResponse.closeN)rrr r!r#rprrrrr�6sr�c@s$eZdZdd�Zdd�Zdd�ZdS)�_MethodcCs||_||_dS)N)�
_Method__send�
_Method__name)r�sendr�rrrr#Msz_Method.__init__cCst|jd|j|f�S)Nz%s.%s)r�r�r�)rr�rrrr�Psz_Method.__getattr__cGs|�|j|�S)N)r�r�)rr�rrrr�Rsz_Method.__call__N)rrr r#r�r�rrrrr�Jsr�c@s~eZdZdZdeZdZdZddd�Zddd	�Z	dd
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)�	Transportz1Handles an HTTP transaction to an XML-RPC server.zPython-xmlrpc/%sTNFcCs||_||_d|_g|_dS)N)NN)r��_use_builtin_types�_connection�_extra_headers)rr�r�rrrr#iszTransport.__init__cCs~xxdD]p}y|�||||�Stjk
rZ}z |sH|jtjtjtjfkrJ�Wdd}~XYqtjk
rt|rp�YqXqWdS)N)rro)	�single_request�socket�error�errnoZ
ECONNRESETZECONNABORTEDZEPIPE�http_clientZ
BadStatusLine)r�host�handler�request_body�verboser��errr�requestys
zTransport.requestcCs�y6|�||||�}|��}|jdkr4||_|�|�SWn2tk
rL�Yntk
rh|���YnX|�dd�r~|�	�t
|||j|jt|�
����dS)N��zcontent-lengthrn)�send_requestZgetresponse�statusr�parse_responser*�	Exceptionrp�	getheaderr�r"�reasonrZ
getheaders)rr�r�r�rZ	http_connZresprrrr��s"
zTransport.single_requestcCst|j|jd�S)N)r�r�)r�r�r�)rrrrr��szTransport.getparsercCsni}t|t�r|\}}t�|�\}}|r`t�|�}t�|��d�}d�|�	��}dd|fg}ng}|||fS)Nzutf-8rnZ
AuthorizationzBasic )
r7r8�urllib_parse�	splituser�unquote_to_bytesrYr\rPrv�split)rr��x509ZauthZ
extra_headersrrr�
get_host_info�s

zTransport.get_host_infocCsJ|jr||jdkr|jdS|�|�\}|_}|t�|�f|_|jdS)Nrro)r�rr�r�ZHTTPConnection)rr��chostrrrr�make_connection�s

zTransport.make_connectioncCs"|jdr|jd��d|_dS)Nro)NN)r�rp)rrrrrp�s
zTransport.closecCs�|�|�}|jdd�}|r&|�d�|jrLtrL|jd|dd�|�d�n|�d|�|�d�|�d|jf�|�||�|�	||�|S)NroZPOSTT)Zskip_accept_encoding)zAccept-Encodingr�)zContent-Typeztext/xmlz
User-Agent)
rr�Zset_debuglevel�accept_gzip_encodingr�Z
putrequestrt�
user_agent�send_headers�send_content)rr�r�r��debug�
connectionr'rrrr�s



zTransport.send_requestcCs"x|D]\}}|�||�qWdS)N)�	putheader)rrr'�key�valrrrrszTransport.send_headerscCsR|jdk	r0|jt|�kr0tr0|�dd�t|�}|�dtt|���|�|�dS)NzContent-Encodingr�zContent-Length)�encode_thresholdr�r�rr�r
Z
endheaders)rrr�rrrr
s
zTransport.send_contentcCs�t|d�r*|�dd�dkr$t|�}q.|}n|}|��\}}x2|�d�}|sLP|jr`tdt|��|�|�q<W||k	r~|�	�|�	�|�	�S)NrzContent-Encodingrnr�izbody:)
r@rr�r�r�r�printrrmrp)rr��streamr�r�rOrrrrs"


zTransport.parse_response)FF)F)F)rrr r!�__version__rrrr#rr�r�rrrprrrrrrrrr�[s


!r�c@seZdZdZdd�ZdS)�
SafeTransportz2Handles an HTTPS transaction to an XML-RPC server.cCsf|jr||jdkr|jdSttd�s0td��|�|�\}|_}|tj|df|pTi�f|_|jdS)Nrro�HTTPSConnectionz1your version of http.client doesn't support HTTPS)r�r@r�r�rr�r )rr�rrrrrrAs

zSafeTransport.make_connectionN)rrr r!rrrrrr<src@sFeZdZdZddd�Zdd�Zdd	�Zd
d�ZeZdd
�Z	dd�Z
dS)�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.
    NFc
Cs�t�|�\}}|dkrtd��t�|�\|_|_|js<d|_|dkrb|dkrRt}	nt}	|	||d�}||_|pnd|_	||_
||_dS)N)�http�httpszunsupported XML-RPC protocolz/RPC2r#)r�r�zutf-8)r
�	splittyper��	splithost�_ServerProxy__host�_ServerProxy__handlerrr��_ServerProxy__transport�_ServerProxy__encoding�_ServerProxy__verbose�_ServerProxy__allow_none)
rZuri�	transportrkrrsr�r�rAr�rrrr#vs 
zServerProxy.__init__cCs|j��dS)N)r(rp)rrrrZ__close�szServerProxy.__closecCsNt|||j|jd��|j�}|jj|j|j||jd�}t	|�dkrJ|d}|S)N)rkrs)rror)
r{r)r+rSr(rr&r'r*r�)rr�r�rr�rrrZ	__request�s

zServerProxy.__requestcCsd|j|jfS)Nz<ServerProxy for %s%s>)r&r')rrrrr(�szServerProxy.__repr__cCst|j|�S)N)r��_ServerProxy__request)rr�rrrr��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__
        rpr,zAttribute %r not foundN)�_ServerProxy__closer(�AttributeError)r�attrrrrr��s
zServerProxy.__call__)NNFFFF)rrr r!r#r.r-r(rr�r�rrrrr!`s
r!�__main__zhttp://localhost:8000�ERRORr��	ro)FF)NNNF)FF)fr!�
__future__rrrrZfuture.builtinsrrrr	r
rY�encodestringr\�decodestringrZ�sysr9rZfuture.backports.httprr�Zfuture.backports.urllibr
r
Zfuture.utilsrZxml.parsersrr�r�r�rr��ImportErrorr�versionrr�r�ZPARSE_ERRORZSERVER_ERRORZAPPLICATION_ERRORZSYSTEM_ERRORZTRANSPORT_ERRORZNOT_WELLFORMED_ERRORZUNSUPPORTED_ENCODINGZINVALID_ENCODING_CHARZINVALID_XMLRPCZMETHOD_NOT_FOUNDZINVALID_METHOD_PARAMSZINTERNAL_ERRORrrr"r)r*r�r�ZBooleanr5r<�objectr=rTrUrVr^r�r_rqr�r�r�r�r�r�r�r�r{r�r�r�r�r�r�r�rr!ZServerrr�rZcurrentTimeZgetCurrentTimeryZmultiZgetData�pow�addr�rrrr�<module>�s�

O	((-'
'
L
b$_


Hacked By AnonymousFox1.0, Coded By AnonymousFox