• File: client.cpython-37.opt-1.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/opt/alt/python37/lib64/python3.7/xmlrpc/__pycache__/client.cpython-37.opt-1.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 33.59 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

Rj^
@sjdZddlZddlZddlZddlmZddlmZddlZddl	Z
ddlmZddl
Z
ddlmZyddlZWnek
rdZYnXddZd	ejdd
ZdZdZd
ZdZdZdZdZd
ZdZdZdZdZ dZ!dZ"Gddde#Z$Gddde$Z%Gddde$Z&Gddde$Z'e(Z)Z*edddZ+e+,d d!krJd"d#Z-n"e+,d$d!krdd%d#Z-nd&d#Z-[+d'd(Z.Gd)d*d*Z/d+d,Z0d-d.Z1Gd/d0d0Z2d1d2Z3e/e2fZ4Gd3d4d4Z5Gd5d6d6Z6Gd7d8d8Z7Gd9d:d:Z8Gd;d<d<Z9Gd=d>d>Z:dZ;Z<Z=dYd@dAZ>dZdBdCZ?d[dDdEZ@dFdGZAd\dIdJZBGdKdLdLerXejCneDZEGdMdNdNZFGdOdPdPZGGdQdRdReGZHGdSdTdTZIeIZJeKdUkrfeIdVZLyeMeLjNOWn.e$k
rZPzeMdWePWddZP[PXYnXe:eLZQeQReQSd
dXeQTdd
yxeQD]ZUeMeUq"WWn.e$k
rdZPzeMdWePWddZP[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}|ddS)N&z&amp;<z&lt;>z&gt;)replace)sr2/opt/alt/python37/lib64/python3.7/xmlrpc/client.pyescapesr
z%d.%diiiDiiipiԁiCiBiiic@seZdZdZddZdS)ErrorzBase class for client errors.cCst|S)N)repr)selfrrr__str__sz
Error.__str__N)__name__
__module____qualname____doc__rrrrrrsrc@s eZdZdZddZddZdS)
ProtocolErrorz!Indicates an HTTP protocol error.cCs&t|||_||_||_||_dS)N)r__init__urlerrcodeerrmsgheaders)rrrrrrrrrs

zProtocolError.__init__cCsd|jj|j|j|jfS)Nz<%s for %s: %s %s>)	__class__rrrr)rrrr__repr__szProtocolError.__repr__N)rrrrrrrrrrrsrc@seZdZdZdS)
ResponseErrorz$Indicates a broken response package.N)rrrrrrrrrsrc@s eZdZdZddZddZdS)Faultz#Indicates an XML-RPC fault package.cKst|||_||_dS)N)rr	faultCodefaultString)rr!r"Zextrarrrrs
zFault.__init__cCsd|jj|j|jfS)Nz<%s %s: %r>)rrr!r")rrrrrszFault.__repr__N)rrrrrrrrrrr sr z%YZ0001cCs
|dS)Nz%Y%m%dT%H:%M:%S)strftime)valuerrr_iso8601_format
sr&z%4YcCs
|dS)Nz%4Y%m%dT%H:%M:%S)r$)r%rrrr&scCs|ddS)Nz%Y%m%dT%H:%M:%S)r$zfill)r%rrrr&scCsLt|trt|St|ttjfs<|dkr2t}t|}d|ddS)Nrz%04d%02d%02dT%02d:%02d:%02d)
isinstancerr&tupletimeZstruct_timeZ	localtime)r%rrr	_strftimes

r-c@sreZdZdZdddZddZddZd	d
ZddZd
dZ	ddZ
ddZddZddZ
ddZddZdS)DateTimezDateTime wrapper for an ISO 8601 string or time tuple or
    localtime integer value to generate 'dateTime.iso8601' XML-RPC
    value.
    rcCs t|tr||_n
t||_dS)N)r*strr%r-)rr%rrrr)s
zDateTime.__init__cCst|tr|j}|j}nzt|tr2|j}t|}n`t|trH|j}|}nJt|drd|}|}n.t|drv|jj	p|t
|}td|jj	|f||fS)N	timetuplerzCan't compare %s and %s)r*r.r%rr&r/hasattrr0rrtype	TypeError)rotherr
oZotyperrrmake_comparable/s$






zDateTime.make_comparablecCs||\}}||kS)N)r6)rr4r
r5rrr__lt__DszDateTime.__lt__cCs||\}}||kS)N)r6)rr4r
r5rrr__le__HszDateTime.__le__cCs||\}}||kS)N)r6)rr4r
r5rrr__gt__LszDateTime.__gt__cCs||\}}||kS)N)r6)rr4r
r5rrr__ge__PszDateTime.__ge__cCs||\}}||kS)N)r6)rr4r
r5rrr__eq__TszDateTime.__eq__cCst|jdS)Nz%Y%m%dT%H:%M:%S)r,strptimer%)rrrrr0XszDateTime.timetuplecCs|jS)N)r%)rrrrr`szDateTime.__str__cCsd|jj|jt|fS)Nz<%s %r at %#x>)rrr%id)rrrrrcszDateTime.__repr__cCst||_dS)N)r/stripr%)rdatarrrdecodefszDateTime.decodecCs$|d||j|ddS)Nz<value><dateTime.iso8601>z</dateTime.iso8601></value>
)writer%)routrrrencodeis
zDateTime.encodeN)r)rrrrrr6r7r8r9r:r;r0rrr@rCrrrrr.#s
r.cCst}|||S)N)r.r@)r?r%rrr	_datetimens
rDcCst|dS)Nz%Y%m%dT%H:%M:%S)rr<)r?rrr_datetime_typetsrEc@s:eZdZdZd
ddZddZddZd	d
ZddZdS)BinaryzWrapper for binary data.NcCs>|dkrd}n&t|ttfs,td|jjt|}||_dS)Nz#expected bytes or bytearray, not %s)r*bytes	bytearrayr3rrr?)rr?rrrrszBinary.__init__cCst|jdS)Nzlatin-1)r/r?)rrrrrszBinary.__str__cCst|tr|j}|j|kS)N)r*rFr?)rr4rrrr;s
z
Binary.__eq__cCst||_dS)N)base64decodebytesr?)rr?rrrr@sz
Binary.decodecCs4|dt|j}||d|ddS)Nz<value><base64>
asciiz</base64></value>
)rArJencodebytesr?r@)rrBencodedrrrrCs
z
Binary.encode)N)	rrrrrrr;r@rCrrrrrF}s
rFcCst}|||S)N)rFr@)r?r%rrr_binarys
rOc@s$eZdZddZddZddZdS)ExpatParsercCsDtdd|_}||_|j|_|j|_|j|_	d}|
|ddS)N)rZParserCreate_parser_targetstartZStartElementHandlerendZEndElementHandlerr?ZCharacterDataHandlerxml)rtargetparserencodingrrrrszExpatParser.__init__cCs|j|ddS)Nr)rQParse)rr?rrrfeedszExpatParser.feedcCs8y
|j}Wntk
rYnX|`|`|dddS)NrGT)rQAttributeErrorrRrY)rrWrrrcloses
zExpatParser.closeN)rrrrrZr\rrrrrPs	rPc@seZdZdZdddZiZddZdd	Zd
dZeee	d<dd
Z
e
ee<ddZeee
<eZddZeee<efddZeee<ddZeee<eee<ddZeee<eee<efddZeee<ddZeee<ddZeee<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)memor?rX
allow_none)rrXr_rrrrszMarshaller.__init__cCsg}|j}|j}t|tr@|d||j|jd||dn8|dx&|D]}|d||||dqNW|dd|}|S)	Nz<fault>
)r!r"z	</fault>
z	<params>
z<param>
z	</param>
z
</params>
)append_Marshaller__dumpr*r r!r"join)rvaluesrBrAdumpvresultrrrdumpss"




zMarshaller.dumpscCsy|jt|}Wnjtk
r|t|ds<tdt|x0t|jD]"}||jkrHtdt|qHW|jd}YnX||||dS)N__dict__zcannot marshal %s objects_arbitrary_instance)dispatchr2KeyErrorr1r3__mro__keys)rr%rAfZtype_rrrZ__dumps
zMarshaller.__dumpcCs|jstd|ddS)Nz0cannot marshal None unless allow_none is enabledz<value><nil/></value>)r_r3)rr%rArrrdump_nilszMarshaller.dump_nilcCs$|d||rdpd|ddS)Nz<value><boolean>10z</boolean></value>
r)rr%rArrr	dump_boolszMarshaller.dump_boolcCs<|tks|tkrtd|d|tt||ddS)Nzint exceeds XML-RPC limitsz<value><int>z</int></value>
)MAXINTMININT
OverflowErrorr/int)rr%rArrr	dump_longs
zMarshaller.dump_longcCs |d|t||ddS)Nz<value><double>z</double></value>
)r)rr%rArrrdump_double%szMarshaller.dump_doublecCs |d||||ddS)Nz<value><string>z</string></value>
r)rr%rAr
rrrdump_unicode+szMarshaller.dump_unicodecCs,|dt|}||d|ddS)Nz<value><base64>
rLz</base64></value>
)rJrMr@)rr%rArNrrr
dump_bytes1s
zMarshaller.dump_bytescCs^t|}||jkrtdd|j|<|j}|dx|D]}|||q8W|d|j|=dS)Nz"cannot marshal recursive sequencesz<value><array><data>
z</data></array></value>
)r=r^r3rb)rr%rAirerfrrr
dump_array9s


zMarshaller.dump_arraycCst|}||jkrtdd|j|<|j}|dxP|D]D\}}|dt|ts^td|d||||||dq<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>
)r=r^r3rbitemsr*r/)rr%rAr
r|rekrfrrrdump_structGs



zMarshaller.dump_structcCs |d|t||ddS)Nz<value><dateTime.iso8601>z</dateTime.iso8601></value>
)r-)rr%rArrr
dump_datetimeYszMarshaller.dump_datetimecCs2|jtkr ||_|||`n||j|dS)N)rWRAPPERSrArCrri)rr%rArrr
dump_instance_s


zMarshaller.dump_instancerj)NF)!rrrrrrkrhrbrpr2rsboolrxrwZdump_intryfloatr
rzr/r{rHrIr}r+listrdictrrrr.rFrrrrr]s<
	r]c@sneZdZdZdEddZddZddZd	d
ZddZd
dZ	ddZ
ddZiZddZ
e
ed<ddZeed<ddZee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/d0Zeed1<d2d3Zeed4<d5d6Zeed7<d8d9Zeed:<d;d<Zeed=<d>d?Zeed@<dAdBZee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)NFzutf-8)
_type_stack_marks_data_value_methodname	_encodingra
_use_datetime
_use_bytes)ruse_datetimeuse_builtin_typesrrrrs

zUnmarshaller.__init__cCs:|jdks|jrt|jdkr0tf|jdt|jS)Nfaultr)rrrr rr+)rrrrr\s

zUnmarshaller.closecCs|jS)N)r)rrrr
getmethodnameszUnmarshaller.getmethodnamecCs
||_dS)N)r)rrXZ
standalonerrrrUszUnmarshaller.xmlcCshd|kr|dd}|dks&|dkr8|jt|jg|_|jrZ||jkrZtd||dk|_dS)N:arraystructzunknown tag %rr%)	splitrralenrrrrkr)rtagZattrsrrrrSszUnmarshaller.startcCs|j|dS)N)rra)rtextrrrr?szUnmarshaller.datacCspy|j|}WnNtk
r\d|kr*dSy|j|dd}Wntk
rVdSXYnX||d|jS)Nrrr`)rkrlrrcr)rrrorrrrTszUnmarshaller.endcCshy|j|}WnNtk
r\d|kr*dSy|j|dd}Wntk
rVdSXYnX|||S)Nrr)rkrlr)rrr?rorrrend_dispatchszUnmarshaller.end_dispatchcCs|dd|_dS)Nr)rar)rr?rrrend_nils
zUnmarshaller.end_nilZnilcCs:|dkr|dn|dkr(|dntdd|_dS)NrrFrqTzbad boolean valuer)rar3r)rr?rrrend_booleanszUnmarshaller.end_booleanbooleancCs|t|d|_dS)Nr)rarwr)rr?rrrend_intszUnmarshaller.end_intZi1Zi2Zi4Zi8rwZ
bigintegercCs|t|d|_dS)Nr)rarr)rr?rrr
end_doubleszUnmarshaller.end_doubleZdoublercCs|t|d|_dS)Nr)rarr)rr?rrrend_bigdecimalszUnmarshaller.end_bigdecimalZ
bigdecimalcCs&|jr||j}||d|_dS)Nr)rr@rar)rr?rrr
end_strings
zUnmarshaller.end_stringstringnamecCs.|j}|j|dg|j|d<d|_dS)Nr)rpoprr)rr?markrrr	end_arrays
zUnmarshaller.end_arrayrcCsd|j}i}|j|d}x,tdt|dD]}||d|||<q.W|g|j|d<d|_dS)Nrrr#)rrrrangerr)rr?rrr~r|rrr
end_structs
zUnmarshaller.end_structrcCs6t}||d|jr"|j}||d|_dS)NrLr)rFr@rCrr?rar)rr?r%rrr
end_base64s
zUnmarshaller.end_base64rJcCs,t}|||jrt|}||dS)N)r.r@rrEra)rr?r%rrrend_dateTimes

zUnmarshaller.end_dateTimezdateTime.iso8601cCs|jr||dS)N)rr)rr?rrr	end_valueszUnmarshaller.end_valuer%cCs
d|_dS)Nparams)r)rr?rrr
end_params#szUnmarshaller.end_paramsrcCs
d|_dS)Nr)r)rr?rrr	end_fault'szUnmarshaller.end_faultrcCs"|jr||j}||_d|_dS)N
methodName)rr@rr)rr?rrrend_methodName+szUnmarshaller.end_methodNamerN)FF)rrrrrr\rrUrSr?rTrrkrrrrrrrrrrrrrrrrrrrssZ
	rc@s$eZdZddZddZddZdS)_MultiCallMethodcCs||_||_dS)N)_MultiCallMethod__call_list_MultiCallMethod__name)rZ	call_listrrrrr8sz_MultiCallMethod.__init__cCst|jd|j|fS)Nz%s.%s)rrr)rrrrr__getattr__;sz_MultiCallMethod.__getattr__cGs|j|j|fdS)N)rrar)rargsrrr__call__=sz_MultiCallMethod.__call__N)rrrrrrrrrrr5src@s eZdZdZddZddZdS)MultiCallIteratorzaIterates over the results of a multicall. Exceptions are
    raised in response to xmlrpc faults.cCs
||_dS)N)results)rrrrrrDszMultiCallIterator.__init__cCsR|j|}t|tikr.t|d|dn t|tgkrF|dStddS)Nr!r"rz#unexpected type in multicall result)rr2r 
ValueError)rr|itemrrr__getitem__Gs
zMultiCallIterator.__getitem__N)rrrrrrrrrrr@src@s4eZdZdZddZddZeZddZdd	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|_dS)N)_MultiCall__server_MultiCall__call_list)rserverrrrraszMultiCall.__init__cCsd|jjt|fS)Nz<%s at %#x>)rrr=)rrrrreszMultiCall.__repr__cCst|j|S)N)rr)rrrrrrjszMultiCall.__getattr__cCs:g}x"|jD]\}}|||dqWt|jj|S)N)rr)rrarrsystemZ	multicall)rZmarshalled_listrrrrrrmszMultiCall.__call__N)	rrrrrrrrrrrrrrPsrFcCsrtrHtrH|rt}tj}n|r&t}t}nt}t}tdd||t}t|}n"t||d}trbt|}nt	|}||fS)zgetparser() -> parser, unmarshaller

    Create an instance of the fastest available parser, and attach it
    to an unmarshalling object.  Return both objects.
    TF)rr)

FastParserFastUnmarshallerrErJrKrOrDr rrP)rrZ
mkdatetimeZmkbytesrVrWrrr	getparsers 

rcCst|trd}n|rt|tr|s&d}tr4t|}n
t||}||}|dkr^dt|}nd}|rx|d|d|df}n|r|d|d	f}n|Sd
|S)adata [,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.
    r#zutf-8z$<?xml version='1.0' encoding='%s'?>
z<?xml version='1.0'?>
z<methodCall>
<methodName>z</methodName>
z</methodCall>
z<methodResponse>
z</methodResponse>
r`)r*r r+FastMarshallerr]rhr/rc)r
methodnameZmethodresponserXr_mr?Z	xmlheaderrrrrhs2



rhcCs2t||d\}}|||||fS)zdata -> 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.
    )rr)rrZr\r)r?rrpurrrloadss	
rc	Cs<tstt}tjd|dd}||WdQRX|S)zhdata -> gzip encoded data

    Encode data using the gzip content encoding as described in RFC 1952
    wbr#)modefileobjZ
compresslevelN)gzipNotImplementedErrorrGzipFilerAgetvalue)r?rogzfrrrgzip_encodesr@c	Cststtjdt|dH}y$|dkr0|}n||d}Wntk
r\tdYnXWdQRX|dkrt||krtd|S)zrgzip encoded data -> unencoded data

    Decode data using the gzip content encoding as described in RFC 1952
    rb)rrrr#zinvalid dataNz#max gzipped payload length exceeded)rrrrreadOSErrorrr)r?Z
max_decoderZdecodedrrrgzip_decodes
rc@s eZdZdZddZddZdS)GzipDecodedResponsezha file-like object to decode a response encoded with the gzip
    method, as described in RFC 1952.
    cCs.tstt||_tjj|d|jddS)Nr)rr)rrrriorr)rresponserrrr=szGzipDecodedResponse.__init__cCs"ztj|Wd|jXdS)N)rrr\r)rrrrr\EszGzipDecodedResponse.closeN)rrrrrr\rrrrr9src@s$eZdZddZddZddZdS)_MethodcCs||_||_dS)N)
_Method__send
_Method__name)rsendrrrrrRsz_Method.__init__cCst|jd|j|fS)Nz%s.%s)rrr)rrrrrrUsz_Method.__getattr__cGs||j|S)N)rr)rrrrrrWsz_Method.__call__N)rrrrrrrrrrrOsrc@s~eZdZdZdeZdZdZdddZddd	Z	dd
dZ
dd
ZddZddZ
ddZddZddZddZddZdS)	Transportz1Handles an HTTP transaction to an XML-RPC server.zPython-xmlrpc/%sTNFcCs||_||_d|_g|_dS)N)NN)r_use_builtin_types_connection_extra_headers)rrrrrrrnszTransport.__init__cCs~xxdD]p}y|||||Stjjk
r8|r4Yqtk
rt}z |sb|jtjtjtjfkrdWdd}~XYqXqWdS)N)rr#)	single_requesthttpclientZRemoteDisconnectedrerrnoZ
ECONNRESETZECONNABORTEDZEPIPE)rhosthandlerrequest_bodyverboser|errrrequest~s

zTransport.requestcCsy6|||||}|}|jdkr4||_||SWn2tk
rLYntk
rh|YnX|ddr~|	t
|||j|jt|
dS)Nzcontent-lengthr`)send_requestZgetresponseZstatusrparse_responser 	Exceptionr\	getheaderrrreasonrZ
getheaders)rrrrrZ	http_connZresprrrrs"
zTransport.single_requestcCst|j|jdS)N)rr)rrr)rrrrrszTransport.getparsercCsri}t|tr|\}}tj|\}}|rdtj|}t|d}d	|
}dd|fg}ng}|||fS)Nzutf-8r`Z
AuthorizationzBasic )r*r+urllibparseZ	splituserZunquote_to_bytesrJrMr@rcr)rrx509ZauthZ
extra_headersrrr
get_host_infos
zTransport.get_host_infocCsL|jr||jdkr|jdS||\}|_}|tj|f|_|jdS)Nrr#)rrrrrZHTTPConnection)rrchostrrrrmake_connections

zTransport.make_connectioncCs |j\}}|rd|_|dS)N)NN)rr\)rr
connectionrrrr\s
zTransport.closecCs||}|jdd}|r&|d|jrLtrL|jd|dd|dn|d||d|d|jf||||	|||S)Nr#ZPOSTT)Zskip_accept_encoding)zAccept-Encodingr)zContent-Typeztext/xmlz
User-Agent)
rrZset_debuglevelaccept_gzip_encodingrZ
putrequestra
user_agentsend_headerssend_content)rrrrdebugrrrrrrs



zTransport.send_requestcCs"x|D]\}}|||qWdS)N)	putheader)rrrkeyvalrrrr	szTransport.send_headerscCsR|jdk	r0|jt|kr0tr0|ddt|}|dtt|||dS)NzContent-EncodingrzContent-Length)encode_thresholdrrrrr/Z
endheaders)rrrrrrrs
zTransport.send_contentcCst|dr*|dddkr$t|}q.|}n|}|\}}x2|d}|sLP|jr`tdt|||q<W||k	r~|	|	|	S)NrzContent-Encodingr`rizbody:)
r1rrrrrprintrrZr\)rrstreamrrr?rrrr%s"


zTransport.parse_response)FF)F)F)rrrr__version__rrrrrrrrrr\rrrrrrrrr`s


!rcs0eZdZdZd	ddfddZddZZS)

SafeTransportz2Handles an HTTPS transaction to an XML-RPC server.FN)contextcstj||d||_dS)N)rr)superrr)rrrr)rrrrFszSafeTransport.__init__cCst|jr||jdkr|jdSttjds2td||\}|_}|tjj|dfd|ji|p`if|_|jdS)Nrr#HTTPSConnectionz1your version of http.client doesn't support HTTPSr)	rr1rrrrrr
r)rrrrrrrrMs

zSafeTransport.make_connection)FF)rrrrrr
__classcell__rr)rrr
Csr
c@s\eZdZdZdddddZddZd	d
ZddZeZd
dZ	ddZ
ddZddZdS)ServerProxyauri [,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.
    NF)rcCstj|\}	}|	dkr tdtj|\|_|_|js@d|_|dkrz|	dkr^t}
d|i}nt}
i}|
f||d|}||_	|pd|_
||_||_dS)N)rhttpszunsupported XML-RPC protocolz/RPC2rr)rrzutf-8)
rrZ	splittyperZ	splithost_ServerProxy__host_ServerProxy__handlerr
r_ServerProxy__transport_ServerProxy__encoding_ServerProxy__verbose_ServerProxy__allow_none)rZuri	transportrXrr_rrrr2rZextra_kwargsrrrrs&

zServerProxy.__init__cCs|jdS)N)rr\)rrrrZ__closeszServerProxy.__closecCsPt|||j|jd|jd}|jj|j|j||jd}t	|dkrL|d}|S)N)rXr_xmlcharrefreplace)rr#r)
rhrrrCrrrrrr)rrrrrrrrZ	__requests

zServerProxy.__requestcCsd|jj|j|jfS)Nz
<%s for %s%s>)rrrr)rrrrrszServerProxy.__repr__cCst|j|S)N)r_ServerProxy__request)rrrrrrszServerProxy.__getattr__cCs.|dkr|jS|dkr|jStd|fdS)z|A workaround to get special attributes on the ServerProxy
           without interfering with the magic __getattr__
        r\rzAttribute %r not foundN)_ServerProxy__closerr[)rattrrrrrs
zServerProxy.__call__cCs|S)Nr)rrrr	__enter__szServerProxy.__enter__cGs|dS)N)r)rrrrr__exit__szServerProxy.__exit__)NNFFFF)
rrrrrrrrrrrrrrrrrrls
r__main__zhttp://localhost:8000ZERROR	)FF)NNNF)FF)r)VrrJsysr,rdecimalrZhttp.clientrZurllib.parserZxml.parsersrrrrrImportErrorr
version_infor	rtruZPARSE_ERRORZSERVER_ERRORZAPPLICATION_ERRORZSYSTEM_ERRORZTRANSPORT_ERRORZNOT_WELLFORMED_ERRORZUNSUPPORTED_ENCODINGZINVALID_ENCODING_CHARZINVALID_XMLRPCZMETHOD_NOT_FOUNDZINVALID_METHOD_PARAMSZINTERNAL_ERRORrrrrr rrZBooleanZ_day0r$r&r-r.rDrErFrOrrPr]rrrrrrrrrhrrrrobjectrrrr
rZServerrrrZcurrentTimeZgetCurrentTimerfZmultiZgetDatapowaddrrrrr<module>s



K	#!(C'
'
J

d)i