Your IP : 3.145.161.199


Current Path : /opt/alt/python312/lib64/python3.12/xmlrpc/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/xmlrpc/__pycache__/client.cpython-312.opt-1.pyc

�

�Q�f�����dZddlZddlZddlZddlmZddlmZddlZddl	Z
ddlmZddl
Z
ddlmZ	ddlZd�Zdej&dd	zZd
ZdZdZd
ZdZdZdZdZdZdZd
ZdZ dZ!dZ"Gd�de#�Z$Gd�de$�Z%Gd�de$�Z&Gd�de$�Z'e(xZ)Z*eddd�Z+d�Z,e,d �rd!�Z-ne,d"�rd#�Z-nd$�Z-[+[,d%�Z.Gd&�d'�Z/d(�Z0d)�Z1Gd*�d+�Z2d,�Z3e/e2fZ4Gd-�d.�Z5Gd/�d0�Z6Gd1�d2�Z7Gd3�d4�Z8Gd5�d6�Z9Gd7�d8�Z:dxZ;xZ<Z=dLd9�Z>		dMd:�Z?dLd;�Z@d<�ZAdNd=�ZBGd>�d?erej�neD�ZEGd@�dA�ZFGdB�dC�ZGGdD�dEeG�ZHGdF�dG�ZIeIZJeKdHk(r{eIdI�ZL	eMeLj�j���e:eL�ZQeQj��eQj�d	dK�eQj�dd	�	eQ�D]
ZUeMeU��yy#e$rdZY���wxYw#e$$rZPeMdJeP�YdZP[P�tdZP[PwwxYw#e$$rZPeMdJeP�YdZP[PydZP[PwwxYw)Oa�
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)�BytesIOc�n�|jdd�}|jdd�}|jdd�S)N�&z&amp;�<z&lt;�>z&gt;)�replace)�ss �4/opt/alt/python312/lib64/python3.12/xmlrpc/client.py�escaper�s3��	�	�	�#�w��A�	�	�	�#�v��A��9�9�S�&�"�"�z%d.%d�i���i�iD���i����i���ip���iԁ��iC���iB���i����i����i����c�(�eZdZdZej
Zy)�ErrorzBase class for client errors.N)�__name__�
__module__�__qualname__�__doc__�object�__str__�rr
rr�s��'��n�n�Grrc��eZdZdZd�Zd�Zy)�
ProtocolErrorz!Indicates an HTTP protocol error.c�f�tj|�||_||_||_||_y�N)r�__init__�url�errcode�errmsg�headers)�selfrr r!r"s     r
rzProtocolError.__init__�s*��
���t�������������rc	��d|jj�d|j�d|j�d|j�d�	S)Nr	� for �: � r
)�	__class__rrr r!�r#s r
�__repr__zProtocolError.__repr__�s.���^�^�
$�
$�d�h�h����d�k�k�
K�	rN�rrrrrr*rrr
rr�s��+��rrc��eZdZdZy)�
ResponseErrorz$Indicates a broken response package.N)rrrrrrr
r-r-�s��.�rr-c��eZdZdZd�Zd�Zy)�Faultz#Indicates an XML-RPC fault package.c�J�tj|�||_||_yr)rr�	faultCode�faultString)r#r1r2�extras    r
rzFault.__init__�s��
���t��"���&��rc�j�d|jj�d|j�d|j�d�S)Nr	r'r&r
)r(rr1r2r)s r
r*zFault.__repr__�s*�� $��� 7� 7� $����0@�0@�B�	BrNr+rrr
r/r/�s��-�'�Brr/�c�R�	tj|�dk(S#t$rYywxYw)N�0001F)�_day0�strftime�
ValueError)�fmts r
�_tryr<s-����~�~�c�"�f�,�,������s��	&�&z%Yc�$�|jd�S�N�%Y%m%dT%H:%M:%S�r9��values r
�_iso8601_formatrCs���~�~�/�0�0rz%4Yc�$�|jd�S)Nz%4Y%m%dT%H:%M:%Sr@rAs r
rCrCs���~�~�0�1�1rc�B�|jd�jd�S)Nr?�)r9�zfillrAs r
rCrCs���~�~�/�0�6�6�r�:�:rc���t|t�rt|�St|ttj
f�s.|dk(rt	j�}t	j|�}d|ddzS)Nrz%04d%02d%02dT%02d:%02d:%02d�)�
isinstancerrC�tuple�time�struct_time�	localtimerAs r
�	_strftimerOs]���%��"��u�%�%��e�e�T�%5�%5�6�7��A�:��I�I�K�E����u�%��(�5��!�9�4�4rc�Z�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zy)�DateTimez�DateTime wrapper for an ISO 8601 string or time tuple or
    localtime integer value to generate 'dateTime.iso8601' XML-RPC
    value.
    c�T�t|t�r||_yt|�|_yr)rJ�strrBrO)r#rBs  r
rzDateTime.__init__.s���e�S�!��D�J�"�5�)�D�Jrc�l�t|t�r|j}|j}||fSt|t�r|j}t	|�}||fSt|t
�r|j}|}||fSt
|d�r$|j�}|j�}||fS|}t}||fS)N�	timetuple)	rJrQrBrrCrS�hasattrrU�NotImplemented�r#�otherr�os    r
�make_comparablezDateTime.make_comparable4s����e�X�&��
�
�A����A��!�t����x�
(��
�
�A���&�A��!�t����s�
#��
�
�A��A��!�t��
�U�K�
(���� �A����!�A��!�t���A��A��!�t�rc�P�|j|�\}}|turtS||kSr�r[rWrXs    r
�__lt__zDateTime.__lt__F�-���#�#�E�*���1����!�!��1�u�rc�P�|j|�\}}|turtS||kSrr]rXs    r
�__le__zDateTime.__le__L�-���#�#�E�*���1����!�!��A�v�
rc�P�|j|�\}}|turtS||kDSrr]rXs    r
�__gt__zDateTime.__gt__Rr_rc�P�|j|�\}}|turtS||k\Srr]rXs    r
�__ge__zDateTime.__ge__Xrbrc�P�|j|�\}}|turtS||k(Srr]rXs    r
�__eq__zDateTime.__eq__^rbrc�B�tj|jd�Sr>)rL�strptimerBr)s r
rUzDateTime.timetupleds���}�}�T�Z�Z�):�;�;rc��|jSrrAr)s r
rzDateTime.__str__ls���z�z�rc�`�d|jj|jt|�fzS)Nz<%s %r at %#x>)r(rrB�idr)s r
r*zDateTime.__repr__os&���4�>�>�#:�#:�D�J�J��4��"Q�Q�Qrc�@�t|�j�|_yr)rS�striprB�r#�datas  r
�decodezDateTime.decoders����Y�_�_�&��
rc�~�|jd�|j|j�|jd�y�Nz<value><dateTime.iso8601>z</dateTime.iso8601></value>
)�writerB)r#�outs  r
�encodezDateTime.encodeus,���	�	�-�.��	�	�$�*�*���	�	�1�2rN)r)rrrrrr[r^rardrfrhrUrr*rrrwrrr
rQrQ(sD���
*��$�����<��R�'�3rrQc�<�t�}|j|�|Sr)rQrr�rqrBs  r
�	_datetimerzzs���J�E�	�L�L����Lrc�.�tj|d�Sr>)rrj)rqs r
�_datetime_typer|�s�����T�#4�5�5rc�0�eZdZdZdd�Zd�Zd�Zd�Zd�Zy)	�BinaryzWrapper for binary data.Nc��|�
d}||_yt|ttf�s"td|jj
z��t|�}||_y)Nrz#expected bytes or bytearray, not %s)rJ�bytes�	bytearray�	TypeErrorr(rrqrps  r
rzBinary.__init__�sX���<��D���	�	�d�U�I�$6�7�� E� $��� 7� 7�!8�9�9���;�D���	rc�.�t|jd�S)Nzlatin-1)rSrqr)s r
rzBinary.__str__�s���4�9�9�i�(�(rc�X�t|t�r|j}|j|k(Sr)rJr~rq)r#rYs  r
rhz
Binary.__eq__�s$���e�V�$��J�J�E��y�y�E�!�!rc�8�tj|�|_yr)�base64�decodebytesrqrps  r
rrz
Binary.decode�s���&�&�t�,��	rc���|jd�tj|j�}|j|j	d��|jd�y�Nz<value><base64>
�asciiz</base64></value>
)rur��encodebytesrqrr)r#rv�encodeds   r
rwz
Binary.encode�sE���	�	�%�&��$�$�T�Y�Y�/���	�	�'�.�.��)�*��	�	�'�(rr)	rrrrrrrhrrrwrrr
r~r~�s��"��)�"�
-�)rr~c�<�t�}|j|�|Sr)r~rrrys  r
�_binaryr��s���H�E�	�L�L����Lrc��eZdZd�Zd�Zd�Zy)�ExpatParserc���tjdd�x|_}||_|j|_|j|_|j|_	d}|j|d�yr)r�ParserCreate�_parser�_target�start�StartElementHandler�end�EndElementHandlerrq�CharacterDataHandler�xml)r#�target�parser�encodings    r
rzExpatParser.__init__�sY�� %� 2� 2�4�� >�>���v����%+�\�\��"�#)�:�:�� �&,�k�k��#����
�
�8�T�"rc�<�|jj|d�y�NF)r��Parserps  r
�feedzExpatParser.feed�s�������4��'rc�h�	|j}|`|`|jdd�y#t$rYywxYw)NrT)r�r�r��AttributeError)r#r�s  r
�closezExpatParser.close�s=��	$��\�\�F���d�l��L�L��d�#��	�	��	�s�%�	1�1N)rrrrr�r�rrr
r�r��s��#�(�$rr�c��eZdZdZdd�ZiZd�Zd�Zd�Zeee	d�<d�Z
e
ee<d�Zeee
<eZd	�Zeee<efd
�Zeee<d�Zeee<eee<d�Zeee<eee<efd
�Zeee<d�Zeee<d�Zeee<eee <eed<y)�
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.
    Nc�<�i|_d|_||_||_yr)�memorqr��
allow_none)r#r�r�s   r
rzMarshaller.__init__�s����	���	� ��
�$��rc�>�g}|j}|j}t|t�r1|d�||j|j
d�|�|d�n0|d�|D]}|d�|||�|d��|d�dj
|�}|S)	Nz<fault>
)r1r2z	</fault>
z	<params>
z<param>
z	</param>
z
</params>
�)�append�_Marshaller__dumprJr/r1r2�join)r#�valuesrvru�dump�v�results       r
�dumpszMarshaller.dumps�s������
�
���{�{���f�e�$��+���v�/�/�!'�!3�!3�5��
�
�,��
�,�����k�"��Q����l�#��
�-� ��������
rc�f�	|jt|�}||||�y#t$r�t|d�st	dt|�z��t|�j
D]5}||jj
�vs� t	dt|�z��|jd}Y��wxYw)N�__dict__zcannot marshal %s objects�_arbitrary_instance)�dispatch�type�KeyErrorrVr��__mro__�keys)r#rBru�f�type_s     r
�__dumpzMarshaller.__dumps���	5��
�
�d�5�k�*�A�	
�$��u����	5��5�*�-�� ;�d�5�k� I�J�J��e��,�,���D�M�M�.�.�0�0�#�$?�$�u�+�$M�N�N�-�
�
�
�3�4�A�	5�s�%�A B0�'B0�/B0c�B�|jstd��|d�y)Nz0cannot marshal None unless allow_none is enabledz<value><nil/></value>)r�r��r#rBrus   r
�dump_nilzMarshaller.dump_nils������N�O�O�
�%�&rc�D�|d�||xrdxsd�|d�y)Nz<value><boolean>�1�0z</boolean></value>
rr�s   r
�	dump_boolzMarshaller.dump_bool s%��
� �!�
�e�m��"�s�#�
�$�%rc��|tkDs	|tkrtd��|d�|tt	|���|d�y)Nzint exceeds XML-RPC limitsz<value><int>z</int></value>
)�MAXINT�MININT�
OverflowErrorrS�intr�s   r
�	dump_longzMarshaller.dump_long&s<���6�>�U�V�^�� <�=�=�
�n��
�c�#�e�*�o��
� �!rc�F�|d�|t|��|d�y)Nz<value><double>z</double></value>
)�reprr�s   r
�dump_doublezMarshaller.dump_double1s ��
�� �
�d�5�k��
�#�$rc�@�|d�|||��|d�y)Nz<value><string>z</string></value>
r)r#rBrurs    r
�dump_unicodezMarshaller.dump_unicode7s ��
�� �
�f�U�m��
�#�$rc�|�|d�tj|�}||jd��|d�yr�)r�r�rr)r#rBrur�s    r
�
dump_byteszMarshaller.dump_bytes=s5��
�!�"��$�$�U�+��
�g�n�n�W�%�&�
�#�$rc���t|�}||jvrtd��d|j|<|j}|d�|D]}|||��
|d�|j|=y)Nz"cannot marshal recursive sequencesz<value><array><data>
z</data></array></value>
)rmr�r�r�)r#rBru�ir�r�s      r
�
dump_arrayzMarshaller.dump_arrayEsh���u�I����	�	�>��@�A�A���	�	�!���{�{��
�&�'��A���E�N��
�)�*��I�I�a�Lrc�v�t|�}||jvrtd��d|j|<|j}|d�|j	�D]J\}}|d�t|t�std��|d||�z�|||�|d��L|d�|j|=y)Nz%cannot marshal recursive dictionariesz<value><struct>
z	<member>
zdictionary key must be stringz<name>%s</name>
z
</member>
z</struct></value>
)rmr�r�r��itemsrJrS)r#rBrurr�r��kr�s        r
�dump_structzMarshaller.dump_structSs����u�I����	�	�>��C�D�D���	�	�!���{�{��
�!�"��K�K�M�D�A�q��,���a��%�� ?�@�@��%��q�	�1�2���E�N��-� �
"�	�#�$��I�I�a�Lrc�F�|d�|t|��|d�yrt)rOr�s   r
�
dump_datetimezMarshaller.dump_datetimees!��
�)�*�
�i����
�-�.rc��|jtvr||_|j|�|`y|j	|j
|�yr)r(�WRAPPERSrurwr�r�r�s   r
�
dump_instancezMarshaller.dump_instanceks<���?�?�h�&��D�J��L�L����
�
���U�^�^�U�3rr�r�)!rrrrrr�r�r�r�r�r��boolr�r��dump_intr��floatrr�rSr�r�r�r�rK�listr��dictr�rr�rQr~rrr
r�r��s����%��H��6�$'�$�H�T�$�Z��&��H�T�N�"��H�S�M��H�%�"�H�U�O�06�%�!�H�S�M�%�
!�H�U�O�$�H�Y��
�!�H�U�O��H�T�N�/5�� !�H�T�N�/�'�H�X��4�'�H�X��$�H�V��'4�H�
"�#rr�c�l�eZdZdZd.d�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZiZd
�Z
e
ed<d�Zeed
<d�Zeed<eed<eed<eed<eed<eed<d�Zeed<eed<d�Zeed<d�Zeed<eed<d�Zeed<d�Zeed <d!�Zeed"<d#�Zeed$<d%�Zeed&<d'�Zeed(<d)�Zeed*<d+�Zeed,<y-)/�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).
    c��d|_g|_g|_g|_d|_d|_d|_|jj|_|xs||_||_	y)NF�utf-8)
�_type�_stack�_marks�_data�_value�_methodname�	_encodingr��
_use_datetime�
_use_bytes)r#�use_datetime�use_builtin_typess   r
rzUnmarshaller.__init__�sY����
���������
������� ����k�k�(�(���.�>�,���+��rc��|j�|jr
t��|jdk(rtdi|jd���t|j�S)N�faultrr)r�r�r-r/r�rKr)s r
r�zUnmarshaller.close�sK���:�:������/�!��:�:�� ��)�$�+�+�a�.�)�)��T�[�[�!�!rc��|jSr)r�r)s r
�
getmethodnamezUnmarshaller.getmethodname�s�����rc��||_yr)r�)r#r��
standalones   r
r�zUnmarshaller.xml�s	��!��rc��d|vr|jd�d}|dk(s|dk(r.|jjt|j��g|_|jr||jvrtd|z��|dk(|_y)N�:����array�structzunknown tag %rrB)	�splitr�r��lenr�r�r�r�r-)r#�tag�attrss   r
r�zUnmarshaller.start�sx���#�:��)�)�C�.��$�C��'�>�S�H�_��K�K���s�4�;�;�/�0���
��;�;�3�d�m�m�3�� 0�3� 6�7�7��g�~��rc�:�|jj|�yr)r�r�)r#�texts  r
rqzUnmarshaller.data�s���
�
���$�rc��	|j|}||dj|j��S#t$r<d|vrYy	|j|jd�d}n#t$rYYywxYwY�fwxYw)Nr�r�r�)r�r�r�r�r�)r#rr�s   r
r�zUnmarshaller.end�s���	��
�
�c�"�A���r�w�w�t�z�z�*�+�+���	��#�~��
��M�M�#�)�)�C�.��"4�5����
��
���		�s3�3�
A8�!A%�$A8�%	A2�.A8�1A2�2A8�7A8c���	|j|}|||�S#t$r<d|vrYy	|j|jd�d}n#t$rYYywxYwY�MwxYw)Nr�r�)r�r�r�)r#rrqr�s    r
�end_dispatchzUnmarshaller.end_dispatch�su��	��
�
�c�"�A���t�}����	��#�~��
��M�M�#�)�)�C�.��"4�5����
��
���		�s2��
A�!A�A�	A�A�A�A�Ac�4�|jd�d|_y�Nr)r�r�rps  r
�end_nilzUnmarshaller.end_nil�s�����D����r�nilc��|dk(r|jd�d|_y|dk(r|jd�d|_ytd��)Nr�Fr�Tzbad boolean valuer)r�r�r�rps  r
�end_booleanzUnmarshaller.end_boolean�sJ���3�;��K�K���
���	�S�[��K�K�������/�0�0r�booleanc�F�|jt|��d|_yr)r�r�r�rps  r
�end_intzUnmarshaller.end_int�s�����C��I����r�i1�i2�i4�i8r��
bigintegerc�F�|jt|��d|_yr)r�r�r�rps  r
�
end_doublezUnmarshaller.end_double�s�����E�$�K� ���r�doubler�c�F�|jt|��d|_yr)r�rr�rps  r
�end_bigdecimalzUnmarshaller.end_bigdecimal�s�����G�D�M�"���r�
bigdecimalc��|jr|j|j�}|j|�d|_yr)r�rrr�r�rps  r
�
end_stringzUnmarshaller.end_string�s.���>�>��;�;�t�~�~�.�D����D����r�string�namec��|jj�}|j|dg|j|dd|_yr)r��popr�r�)r#rq�marks   r
�	end_arrayzUnmarshaller.end_arrays7���{�{��� ��"�k�k�$�%�0�1����D�E����rr�c���|jj�}i}|j|d}tdt	|�d�D]}||dz|||<�|g|j|dd|_y)Nrrr5)r�r r��ranger�r�)r#rqr!r�r�r�s      r
�
end_structzUnmarshaller.end_structsl���{�{��� �������D�E�"���q�#�e�*�a�(�A�"�1�Q�3�Z�D��q��N�)�"�V����D�E����rr�c��t�}|j|jd��|jr|j}|j|�d|_y)Nr�r)r~rrrwr�rqr�r��r#rqrBs   r
�
end_base64zUnmarshaller.end_base64sA�����
���T�[�[��)�*��?�?��J�J�E����E����rr�c��t�}|j|�|jrt|�}|j	|�yr)rQrrr�r|r�r's   r
�end_dateTimezUnmarshaller.end_dateTime s4���
��
���T�����"�4�(�E����E�rzdateTime.iso8601c�@�|jr|j|�yyr)r�rrps  r
�	end_valuezUnmarshaller.end_value(s���;�;��O�O�D�!�rrBc��d|_y)N�params�r�rps  r
�
end_paramszUnmarshaller.end_params/s	����
rr.c��d|_y)Nr�r/rps  r
�	end_faultzUnmarshaller.end_fault3s	����
rr�c�n�|jr|j|j�}||_d|_y)N�
methodName)r�rrr�r�rps  r
�end_methodNamezUnmarshaller.end_methodName7s*���>�>��;�;�t�~�~�.�D����!��
rr4N�FF)rrrrrr�r�r�r�rqr�rr�r	rrrrrr"r%r(r*r,r0r2r5rrr
r�r�sa���
,�"� �"�	'� �,� � �H���H�U�O��&�H�Y����H�T�N��H�T�N��H�T�N��H�T�N��H�U�O�$�H�\���$�H�X��"�H�W���,�H�\���
$�H�X��!�H�V���
"�H�W���$�H�X���$�H�X���$0�H�
� �"�
"�H�W���#�H�X���!�H�W��"�
,�H�\�rr�c��eZdZd�Zd�Zd�Zy)�_MultiCallMethodc� �||_||_yr)�_MultiCallMethod__call_list�_MultiCallMethod__name)r#�	call_listrs   r
rz_MultiCallMethod.__init__Ds��$�����rc�L�t|j|j�d|���S�N�.)r8r:r;�r#rs  r
�__getattr__z_MultiCallMethod.__getattr__Gs���� 0� 0�T�[�[�$�2O�P�Prc�R�|jj|j|f�yr)r:r�r;�r#�argss  r
�__call__z_MultiCallMethod.__call__Is����������d� 3�4rN�rrrrrArErrr
r8r8As���Q�5rr8c��eZdZdZd�Zd�Zy)�MultiCallIteratorzaIterates over the results of a multicall. Exceptions are
    raised in response to xmlrpc faults.c��||_yr)�results)r#rJs  r
rzMultiCallIterator.__init__Ps	����rc��|j|}t|t�rt|d|d��t|t�r|dStd��)Nr1r2rz#unexpected type in multicall result)rJrJr�r/r�r:)r#r��items   r
�__getitem__zMultiCallIterator.__getitem__SsO���|�|�A����d�D�!���[�)�4�
�+>�?�?�
��d�
#���7�N��B�C�CrN)rrrrrrMrrr
rHrHLs��,��DrrHc�(�eZdZdZd�Zd�Zd�Zd�Zy)�	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()
    c� �||_g|_yr)�_MultiCall__server�_MultiCall__call_list)r#�servers  r
rzMultiCall.__init__ms����
���rc�J�d|jjt|�fzS)Nz<%s at %#x>)r(rrmr)s r
r*zMultiCall.__repr__qs ������ 7� 7��D��B�B�Brc�.�t|j|�Sr)r8rRr@s  r
rAzMultiCall.__getattr__ts���� 0� 0�$�7�7rc��g}|jD]\}}|j||d���t|jjj|��S)N)r4r.)rRr�rHrQ�system�	multicall)r#�marshalled_listrrDs    r
rEzMultiCall.__call__wsP�����*�*�J�D�$��"�"�4�D�#I�J�+�!����!5�!5�!?�!?��!P�Q�QrN)rrrrrr*rArErrr
rOrO\s��� �C�8�RrrOc�(�tr\trV|rt}tj}n|r
t}t
}nt}t
}tdd||t�}t|�}||fSt||��}trt|�}||fSt|�}||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�FastUnmarshallerr|r�r�r�rzr/r�r�)r�r��
mkdatetime�mkbytesr�r�s      r
�	getparserr`�s����&��'�J��(�(�G�
�'�J��G�"�J��G�!�$��w�
�E�J���F�#���6�>���<�K\�]�����'�F��6�>��!��(�F��6�>�rc�,�t|t�rd}n|rt|t�r|sd}trt|�}nt	||�}|j|�}|dk7rdt
|�z}nd}|r	|d|d|df}n|r|d|d	f}n|Sd
j|�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.
    r5r�z$<?xml version='1.0' encoding='%s'?>
z<?xml version='1.0'?>
z<methodCall>
<methodName>z</methodName>
z</methodCall>
z<methodResponse>
z</methodResponse>
r�)rJr/rK�FastMarshallerr�r�rSr�)r.�
methodname�methodresponser�r��mrq�	xmlheaders        r
r�r��s���0�&�%� ���	�J�v�u�5������8�$���x��,���7�7�6�?�D��7��;�c�(�m�K�	�-�	��
�
�&�(9�����
�
� ��!�	����
�7�7�4�=�rc��t||��\}}|j|�|j�|j�|j�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�r�r�)rqr�r��p�us     r
�loadsrj�sA���,�BS�T�D�A�q��F�F�4�L��G�G�I��7�7�9�a�o�o�'�'�'rc���tst�t�}tjd|d��5}|j	|�ddd�|j�S#1swY|j�SxYw)zhdata -> gzip encoded data

    Encode data using the gzip content encoding as described in RFC 1952
    �wbr5)�mode�fileobj�
compresslevelN)�gzip�NotImplementedErrorr�GzipFileru�getvalue)rqr��gzfs   r
�gzip_encoderusT��
�!�!��	�A�	
���D�!�1�	=���	�	�$��
>��:�:�<��
>��:�:�<��s�A�A1c�J�tst�tjdt|���5}	|dkr|j	�}n|j	|dz�}ddd�|dk\rt�|kDrt
d��S#t
$rt
d��wxYw#1swY�AxYw)zrgzip encoded data -> unencoded data

    Decode data using the gzip content encoding as described in RFC 1952
    �rb�rmrnrr5zinvalid dataNz#max gzipped payload length exceeded)rprqrrr�read�OSErrorr:r�)rq�
max_decodert�decodeds    r
�gzip_decoder})s���
�!�!�	
���D�'�$�-�	8�C�	-��A�~��(�(�*���(�(�:��>�2��
9��Q��3�w�<�*�4��>�?�?��N��	�	-��^�,�,�	-��

9�	8�s�B�*B�B�B�B"c��eZdZdZd�Zd�Zy)�GzipDecodedResponsezha file-like object to decode a response encoded with the gzip
    method, as described in RFC 1952.
    c��tst�t|j��|_tj
j
|d|j��y)Nrwrx)rprqrry�iorrr)r#�responses  r
rzGzipDecodedResponse.__init__Gs<���%�%��(�-�-�/�*����
�
���t�$�����@rc��	tjj|�|jj�y#|jj�wxYwr)rprrr�r�r)s r
r�zGzipDecodedResponse.closeOs4��	��M�M����%��G�G�M�M�O��D�G�G�M�M�O�s	�<�AN)rrrrrr�rrr
rrCs���A�rrc��eZdZd�Zd�Zd�Zy)�_Methodc� �||_||_yr��
_Method__send�
_Method__name)r#�sendrs   r
rz_Method.__init__\s�������rc�L�t|j|j�d|���Sr>)r�r�r�r@s  r
rAz_Method.__getattr___s���t�{�{�t�{�{�D�$A�B�Brc�:�|j|j|�Srr�rCs  r
rEz_Method.__call__as���{�{�4�;�;��-�-rNrFrrr
r�r�Ys���C�.rr�c�p�eZdZdZdezZdZdZddd�d�Zdd�Z	dd	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zy)�	Transportz1Handles an HTTP transaction to an XML-RPC server.zPython-xmlrpc/%sTNr)r"c�\�||_||_d|_t|�|_g|_y�N)NN)r��_use_builtin_types�_connectionr��_headers�_extra_headers)r#r�r�r"s    r
rzTransport.__init__xs-��)���"3���'����W�
��
� ��rc�(�dD]}	|j||||�cSy#tjj$r|r�Y�>t$rH}|s;|j
t
jt
jt
jfvr�Yd}~��d}~wwxYw)N)rr5)	�single_request�http�client�RemoteDisconnectedrz�errno�
ECONNRESET�ECONNABORTED�EPIPE)r#�host�handler�request_body�verboser��es       r
�requestzTransport.request�s����A�
��*�*�4��,��P�P����;�;�1�1�
�����
������(8�(8�%�:L�:L�(-���(5�5��5��
�s�� B�B�	>B�Bc	��	|j||||�}|j�}|jdk(r||_|j	|�S	|jdd�r|j�t||z|j|jt|j����#t
$r�t$r|j��wxYw)N��zcontent-lengthr�)�send_request�getresponse�statusr��parse_responser/�	Exceptionr��	getheaderryr�reasonr��
getheaders)r#r�r�r�r��	http_conn�resps       r
r�zTransport.single_request�s���
	��)�)�$���w�O�I��(�(�*�D��{�{�c�!�&����*�*�4�0�0�"��>�>�*�B�/��I�I�K���7�N��K�K��������"�#��	���	���	�
�J�J�L��		�s�A
B,�,$Cc�D�t|j|j��S)Nr[)r`r�r�r)s r
r`zTransport.getparser�s"���d�&8�&8�+/�+B�+B�D�	Drc�\�i}t|t�r|\}}tjj	|�\}}|rktjj|�}t
j|�jd�}dj|j��}dd|zfg}ng}|||fS)Nr�r��
AuthorizationzBasic )rJrK�urllib�parse�
_splituser�unquote_to_bytesr�r�rrr�r�)r#r��x509�auth�
extra_headerss     r
�
get_host_infozTransport.get_host_info�s������d�E�"��J�D�$��\�\�,�,�T�2�
��d���<�<�0�0��6�D��%�%�d�+�2�2�7�;�D��7�7�4�:�:�<�(�D� �(�T�/�2��M��M��]�D�(�(rc��|jr!||jdk(r|jdS|j|�\}|_}|tjj|�f|_|jdS)Nrr5)r�r�r�r�r��HTTPConnection�r#r��chostr�s    r
�make_connectionzTransport.make_connection�sw�������(8�(8��(;� ;��#�#�A�&�&�+/�+=�+=�d�+C�(��t�"�D�����!;�!;�E�!B�B�������"�"rc�V�|j\}}|rd|_|j�yyr�)r�r�)r#r��
connections   r
r�zTransport.close�s.���+�+���j��+�D������rc��|j|�}|j|jz}|r|jd�|jr,t
r&|j
d|d��|jd�n|j
d|�|jd�|jd|jf�|j||�|j||�|S)Nr5�POSTT)�skip_accept_encoding)zAccept-Encodingrp)zContent-Typeztext/xmlz
User-Agent)r�r�r��set_debuglevel�accept_gzip_encodingrp�
putrequestr��
user_agent�send_headers�send_content)r#r�r�r��debugr�r"s       r
r�zTransport.send_request�s����)�)�$�/�
��-�-�$�"5�"5�5����%�%�a�(��$�$���!�!�&�'��!�M��N�N�6�7��!�!�&�'�2����3�4�����d�o�o�6�7����*�g�.����*�l�3��rc�<�|D]\}}|j||��yr)�	putheader)r#r�r"�key�vals     r
r�zTransport.send_headerss ���H�C��� � ��c�*� rc��|j�;|jt|�kr#tr|jdd�t	|�}|jdtt|���|j
|�y)N�Content-EncodingrpzContent-Length)�encode_thresholdr�rpr�rurS�
endheaders)r#r�r�s   r
r�zTransport.send_content sh���!�!�-��!�!�C��$5�5��� � �!3�V�<�&�|�4�L����-�s�3�|�3D�/E�F����l�+rc��t|d�r$|jdd�dk(rt|�}n|}n|}|j�\}}|j	d�x}rF|j
rt
dt|��|j|�|j	d�x}r�F||ur|j�|j�|j�S)Nr�r�r�rpizbody:)
rVr�rr`ryr��printr�r�r�)r#r��streamrhrirqs      r
r�zTransport.parse_response1s����8�[�)��!�!�"4�b�9�V�C�,�X�6��!���F��~�~����1��k�k�$�'�'�d�'��|�|��g�t�D�z�*�
�F�F�4�L��k�k�$�'�'�d�'�
��!��L�L�N�	���	��w�w�y�rr6)F)rrrr�__version__r�r�r�rr�r�r`r�r�r�r�r�r�r�rrr
r�r�jsb��;�$�k�1�J� ��
��!��!�$��BD�)�4#���.+�	,�"rr�c�2��eZdZdZdddd��fd�Zd�Z�xZS)�
SafeTransportz2Handles an HTTPS transaction to an XML-RPC server.rN�r"�contextc�8��t�|�|||��||_y)N�r�r�r")�superrr�)r#r�r�r"r�r(s     �r
rzSafeTransport.__init__Os&���
���l�+<�!(�	�	*���rc�h�|jr!||jdk(r|jdSttjd�st	d��|j|�\}|_}|tjj|dfd|ji|xsi��f|_|jdS)Nrr5�HTTPSConnectionz1your version of http.client doesn't support HTTPSr�)	r�rVr�r�rqr�r�r�r�r�s    r
r�zSafeTransport.make_connectionXs��������(8�(8��(;� ;��#�#�A�&�&��t�{�{�$5�6�%�?�A�
A�,0�+=�+=�d�+C�(��t�"�D�����!<�!<�U��"8��,�,�"8�+/�:�2�"8�8�������"�"rr6)rrrrrr��
__classcell__)r(s@r
r�r�Ls���<�����#rr�c�N�eZdZdZ		d
ddd�d�Zd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zy)�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.
    Nrr�c��tjj|�}
|
jdvrt	d��|
j
|_tjjddg|
dd��|_|jsd|_|�.|
jdk(rt}d|	i}nt}i}|d
|||d�|��}||_|xsd	|_||_
||_y)N)r��httpszunsupported XML-RPC protocolr�rz/RPC2r�r�r�r�r)r�r��urlsplit�schemerz�netloc�_ServerProxy__host�
urlunsplit�_ServerProxy__handlerr�r��_ServerProxy__transport�_ServerProxy__encoding�_ServerProxy__verbose�_ServerProxy__allow_none)
r#�uri�	transportr�r�r�r�r�r"r�rhr��extra_kwargss
             r
rzServerProxy.__init__�s���
�L�L�!�!�#�&���8�8�,�,��8�9�9��h�h������0�0�"�b�1A�1�Q�R�5�1A�B����~�~�$�D�N����x�x�7�"�'�� )�7�3��#��!���0�\�2C�(/�0�#/�0�I�%���"�-�g��� ���&��rc�8�|jj�yr)r�r�r)s r
�__closezServerProxy.__close�s������� rc� �t|||j|j��j|jd�}|jj|j|j||j��}t|�dk(r|d}|S)N)r�r��xmlcharrefreplace)r�r5r)
r�r�r�rwr�r�r�r�r�r�)r#rcr.r�r�s     r
�	__requestzServerProxy.__request�s�����
�T�_�_�#'�#4�#4�6�6<�f�T�_�_�Na�6b�	��#�#�+�+��K�K��N�N���N�N�	,����x�=�A����{�H��rc�h�d|jj�d|j�|j�d�S)Nr	r%r
)r(rr�r�r)s r
r*zServerProxy.__repr__�s(���^�^�
$�
$�d�k�k�4�>�>�
C�	rc�.�t|j|�Sr)r��_ServerProxy__requestr@s  r
rAzServerProxy.__getattr__�s���t�~�~�t�,�,rc�d�|dk(r|jS|dk(r|jStd|�d���)z|A workaround to get special attributes on the ServerProxy
           without interfering with the magic __getattr__
        r�r�z
Attribute z
 not found)�_ServerProxy__closer�r�)r#�attrs  r
rEzServerProxy.__call__�s7���7�?��<�<��
�[�
 ��#�#�#���?�@�@rc��|Srrr)s r
�	__enter__zServerProxy.__enter__�s���rc�$�|j�yr)r�rCs  r
�__exit__zServerProxy.__exit__�s�����r)NNFFFF)rrrrrr�r�r*rArEr�rrrr
r�r�wsD���*DI�IN�'���'�>!��$�-�A��rr��__main__zhttp://localhost:8000�ERROR�	r6)NNNF)i@)Vrr��sysrLr�decimalr�http.clientr��urllib.parser��xml.parsersrr�r�rrp�ImportErrorr�version_infor�r�r��PARSE_ERROR�SERVER_ERROR�APPLICATION_ERROR�SYSTEM_ERROR�TRANSPORT_ERROR�NOT_WELLFORMED_ERROR�UNSUPPORTED_ENCODING�INVALID_ENCODING_CHAR�INVALID_XMLRPC�METHOD_NOT_FOUND�INVALID_METHOD_PARAMS�INTERNAL_ERRORr�rrr-r/r�r
�Booleanr8r<rCrOrQrzr|r~r�r�r�r�r�r8rHrOrbr\r]r`r�rjrur}rrrrr�r�r�r��ServerrrSr��currentTime�getCurrentTimer��multi�getData�pow�addr�rrr
�<module>r s���r(�T�
�����������#���(�(��!�,�,����	���������������������������I���E��&	�E�	�B�E�B� ���'�"	��A�q����
��:�1�	�%�[�2�;�	��	5�P3�P3�d�6�!)�!)�F�
�f���
$�$�B`4�`4�N},�},�D	5�	5�D�D�  R� R�J26�5��5��.��NBF��@�V(�,
�0�4�4�$�-�-�V��,	.�	.�"]�]�D#�I�#�Ve�e�R
��
�z��
�0�
1�F��
�f� � �/�/�1�2�
�f��E�	�M�M�O�	�I�I�a��N�	�I�I�a��N����H��(�O� �#��m*���D���~*��
�g�q��������
�g�q�����sA�H� H�-H,�H�
H�H)�	H$�$H)�,I�1	H?�?I

?>