ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/usr/lib/python2.7/site-packages/rhn/
Upload File :
Current File : //proc/self/root/proc/self/root/usr/lib/python2.7/site-packages/rhn/rpclib.pyc

�
���[c@sWdZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZddl
m
Z
ddlZdZd�Zd�Zd�Zd	efd
��YZdfd��YZd
efd��YZdefd��YZdefd��YZd�Zdfd��YZdefd��YZd�ZdS(s2.5.65-8.el7i����N(tListTypet	TupleTypet
StringTypetUnicodeTypetDictTypetDictionaryType(tUserDictCaseicCs*ytjtj|�tSWntSXdS(s5 Returns true if n is IPv6 address, false otherwise. N(tsockett	inet_ptontAF_INET6tTruetFalse(tn((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyt
check_ipv6$s
c	Cs8|jdd�}d	}d	}d	}d	}t|�dkr�|d}|djdd�}|d}t|�dkr�|d}q�n
|d}|ddkr�tjdtd�\}}|jd�jd�}nPt|�r�|}n;|jdd�}|d}t|�dkr(|d}n||||fS(
s| Function used to split host information in an URL per RFC 2396
        handle full hostname like user:passwd@host:port
    t@iiit:t[s(?<=\]):t]N(tsplittNonetlentretip_porttlstriptrstripR
(	t
hoststringtlthosttporttusertpasswdthostporttuserinfotarr((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyt
split_host,s,


	

cCsS|dkrtd�n|jdd�}t|�dkrI|d}nt|�S(NsHost string cannot be nulls://ii(Rt
ValueErrorRRR"(tproxyR!((s./usr/lib/python2.7/site-packages/rhn/rpclib.pytget_proxy_infoQs
tMalformedURIErrorcBseZRS((t__name__t
__module__(((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR&]stServerc
Bs^eZdZejZejZejZ	ej
Zdddddddddd�	Z
ddddd�Zd�Zd�Zd�Zd�Zdd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�ZeZd�Zddd�Z d�Z!d�Z"d�Z#d�Z$d�Z%dd�Z&d�Z'd�Z(RS(s7uri [,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)
        verbose: verbosity level
        proxy: use an HTTP proxy
        username: username for authenticated HTTP proxy
        password: password for authenticated HTTP proxy

    All 8-bit strings passed to the server proxy are assumed to use
    the given encoding.
    icCs�|dkr�t|�\}}}
}|dk	rCd||f}n|}|
dk	r�|dkr�|
}|dk	r�|dkr�|}q�q�n||_d|_d|_d|_||_||_||_|
|_	t
tj��dkrtj�d|_
n	t|_
|j�|dkrMd|_|j|j||||
�}n	d|_d|_d|_||_g|_d|_||_||_|j|�|j|	�d|_t�|_dS(Ns%s:%sii(RR%t_urit_refreshCallbackt_progressCallbackt_bufferSizet_proxyt	_usernamet	_passwordt_timeoutRt__version__Rtrpc_versiont_reset_host_handler_and_typet_allow_redirecttdefault_transportt_typet_redirectedtuse_handler_patht
_transportt_trusted_cert_filest_langt	_encodingt_verbosetset_refresh_callbacktset_progress_callbacktsend_handlerRt_headers(tselfturit	transporttencodingtverboseR$tusernametpasswordtrefreshCallbacktprogressCallbackttimeouttphtpptputpw((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyt__init__�sJ									
									

	cCs�|rZ|dkr6|j|d|d|d|�}q�|j|d|d|d|�}n3|dkr{|jd|�}n|jd|�}|S(Nthttpst
proxyUsernamet
proxyPasswordRL(t_transport_class_https_proxyt_transport_class_proxyt_transport_class_httpst_transport_class(RCttypeR$RHRIRLRE((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR6�scCs
||_dS(N(R5(RCtallow((s./usr/lib/python2.7/site-packages/rhn/rpclib.pytallow_redirect�scCs|js
dS|jS(N(R5RR8(RC((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyt
redirected�s	cCs||_|jj|�dS(N(R+R:R?(RCRJ((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR?�s	cCs||_|jj|�dS(N(R-R:tset_buffer_size(RCt
bufferSize((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR]�s	i@cCs ||_|jj||�dS(N(R,R:R@(RCRKR^((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR@�s	cCstj||d|j�S(NRF(t	xmlrpclibtdumpsR=(RCtparamst
methodname((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyt	_req_body�scCs|jr|jjSdS(N(R:t
headers_inR(RC((s./usr/lib/python2.7/site-packages/rhn/rpclib.pytget_response_headers�s	
cCs|jr|jjSdS(N(R:tresponse_statusR(RC((s./usr/lib/python2.7/site-packages/rhn/rpclib.pytget_response_status�s	
cCs|jr|jjSdS(N(R:tresponse_reasonR(RC((s./usr/lib/python2.7/site-packages/rhn/rpclib.pytget_response_reason�s	
c	Cs
|j�}|sdS|jd�}|s/dStd|j��}|ddksZt�t|�dksrt�|djd�}t|�dks�t�|\}}|dkr�d}nt|�}|jd�\}}i|d	6t|�d
6t|�d6}|S(
sSReturns a dictionary with three values:
            length: the total length of the entity-body (can be None)
            first_byte_pos: the position of the first byte (zero based)
            last_byte_pos: the position of the last byte (zero based)
           The range is inclusive; that is, a response 8-9/102 means two bytes
        s
Content-Rangeitbytesiit/t*t-tlengthtfirst_byte_post
last_byte_posN(ReRtgettfilterRtAssertionErrorRtint(	RCtheaderst
content_rangeR!tbranget	total_lentstarttendtresult((s./usr/lib/python2.7/site-packages/rhn/rpclib.pytget_content_range�s*	
cCs1|j�}|sdS|jd�r-|dSdS(Ns
Accept-Ranges(ReRthas_key(RCRu((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyt
accept_rangesscCs�tj|j�\}}|d
kr0td�nt|�dksU|dd!dkr^t�n|d
kr||j�|_n	||_|jdkr�td�ntj	|�\|_
|_|js�d	|_nd
S(s Reset the attributes:
            self._host, self._handler, self._type
            according the value of self._uri.
        smissing protocol in uriiiis//thttpRRsunsupported XML-RPC protocols/RPC2N(Rshttps(turllibt	splittypeR*RR&RtlowerR7tIOErrort	splithostt_hostt_handler(RCRYRD((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR4's%			c	Gs(d}g}x�|D]�}t|�}|tks=|tkrUtj|d|�}n�|tkr|tt|j|��}ns|t	kr�t|j|�}nR|t
ks�|tkr�tg|j
�D]\}}|j||�^q��}n|j|�qWt|�dkr|dSt|�SdS(s> Strip characters, which are not allowed according:
            http://www.w3.org/TR/2006/REC-xml-20060816/#charsets
            From spec:
            Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]  /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
        s#[\x00-\x09]|[\x0b-\x0c]|[\x0e-\x1f]tiiN(RYRRRtsubRttupletmapt_strip_charactersRRRtdictt	iteritemstappendR(RCtargstregexpR{titemt	item_typetnametval((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR�>s 
:cCs�d}d}|j�xg|tkr4td��n|jj�x0|jj�D]\}}|jj||�qQW|jjdd|j	�|jjdd�|j
r�|jjdd�n|r�|jjd	d
�|jr�|jjd|j�q�n|j|j
|�|�}y7|jj|j|j|d|j�}|jj}	Wn.tjk
r�}
|jrt�q�|
j}	nXd|_|d7}|	d
kr�Pn|	dkr�d|_qn|jj�|_d|_d}|j
s�td��n|jrd|j|jfGHntj|j�\}}|dkrL|j�}n|dkrktd|��n|jdkr�|dkr�td��ntj|�\|_|_|js�d|_n|`|j ||j!|j"|j#|j$�|_|j%|j&�|j'|j(�|j)|j*�|j+|j,�|j-gkrt.|jd�rx$|j-D]}
|jj/|
�q`Wqqt0|t1j2�r�|St0|t3�r�t4|�dkr�|d}n|S(sM Call a method on the remote server 
            we can handle redirections. is!Unable to fetch requested PackagesX-Infos+RPC Processor (C) Red Hat, Inc (version %s)sX-Client-VersionisX-RHN-Transport-Capabilitysfollow-redirects=3sX-RHN-Redirectt0s
X-RHN-PathRGi�i-i.sRedirects not alloweds%s redirected to %sRRRs%Redirected to unsupported protocol %ss)HTTPS redirected to HTTP is not supporteds/RPC2tadd_trusted_certN(i-i.(shttpshttps(5R4tMAX_REDIRECTIONStInvalidRedirectionErrorR:t
clear_headersRBtitemst
set_headert
add_headerR3R5RARcR�trequestR�R�R>RfR_t
ProtocolErrorR9terrcodeRR8R\R*R�R�R�R7R�R6R.R/R0R1R@R,R?R+R]R-tsetlangR<R;thasattrR�t
isinstancet
transportstFileRR(RCRbRatredirect_responsetretrytktvR�tresponset
save_responsetpettypRDtcertfile((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyt_requestXs�

	
		
	
					!
cCsd|jj|j|jfS(Ns
<%s for %s%s>(t	__class__R'R�R�(RC((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyt__repr__�scCst|j|�S(N(t_MethodR�(RCR�((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyt__getattr__�scKsB|js
dS|ji|d6|d6�t|jjd|�dS(NttransferRF((R:tupdatetapplytset_transport_flags(RCR�RFtkwargs((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR��s		cCs|js
iS|jj�S(N(R:tget_transport_flags(RC((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR��s	cCsdS(N((RC((s./usr/lib/python2.7/site-packages/rhn/rpclib.pytreset_transport_flags�scCsTt|�tg�td�gkr=tt|�|j|<nt|�|j|<dS(N((RYR�tstrRB(RCR�targ((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR��s$cCse|jj|�r=|j|}t|t�sN|g}qNng}|j|<|jt|��dS(N(RBR}R�RR�R�(RCR�R�tvlist((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR��s
cCs;||_|jr7t|jd�r7|jj|�ndS(NR�(R<R:R�R�(RCtlang((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR�s	cCs
td�dS(NsThis method is deprecated(tNotImplementedError(RCtca_chain((s./usr/lib/python2.7/site-packages/rhn/rpclib.pytuse_CA_chainscCsB|jj|�|jr>t|jd�r>|jj|�ndS(NR�(R;R�R:R�R�(RCR�((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR�	scCs&|jr"|jj�d|_ndS(N(R:tcloseR(RC((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR�s	
N()R'R(t__doc__R�t	TransportRXt
SafeTransportRWtProxyTransportRVtSafeProxyTransportRURRQR6R[R\R?R]R@RcReRgRiR|R~R4R�R�R�t__str__R�R�R�R�R�R�R�R�R�R�(((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR)bsH					C										#				s		
				
		t	GETServerc
BsteZdddddidddd�	Zd�Zd�Zddd�Zd�Zd�Zddddd�Z	RS(	icCsrtj||d|d|d|d|d|d|	d|
�||_||_|j|_|jddd	d�dS(
NR$RHRIRERJRKRLtoffsettamount(R)RQt_client_versionRBR�t
_orig_handlert	set_rangeR(RCRDRER$RHRItclient_versionRuRJRKRL((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyRQs		cCs�|st|�dkr(td��ntd�|jjd��}|d|d|gt|d�}ddj|�|_|j|_|j	r�|j
r�|j�|_nx0|jj
�D]\}}|jj||�q�W|jdk	r�|jdkrIt|j�d}|jdk	r]|t|j|jd�}q]ndt|j�}|jjdd	|�|jjd
d�ndS(Nis$Required parameter channel not foundcSs
|dkS(NR�((tx((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyt<lambda>+sRks$RHNiRmtRangesbytes=tallow_partial_contentR�(Rt	ExceptionRrR�RtlisttjoinR�RAR8R9t
_new_req_bodyRBR�R:R�t_offsetRR�t_amountR�(RCRaRbth_compsthndlthR�Rw((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyRc's&%$cCs1tj|j�\}}tj|�\}}|S(N(R�R�R8R�(RCRYttmpuritsitethandler((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR�KscCs�|dk	rSyt|�}WqStk
rOtd|�dtj�d�qSXn|dk	r�yt|�}Wn1tk
r�td|�dtj�d�nX|dkr�td|��q�n||_||_dS(NsInvalid value `%s' for offsetisInvalid value `%s' for amounti(RRtR#t
RangeErrortsystexc_infoR�R�(RCR�R�((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR�Ps
'
$	cCs|jjdd�dS(NR�i(R:R�(RC((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR�escCst|j|�S(N(t
SlicingMethodR�(RCR�((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR�hscCs;tj||d|d|d|d|�}|jd�|S(NR$RHRIRLtGET(R)R6t
set_method(RCRYR$RHRIRLtret((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR6ls*
N(
R'R(RRQRcR�R�R�R�R6(((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR�s		$				R�cBseZRS((R'R((((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR�rsR�cBseZRS((R'R((((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR�uscCsUddl}t||j�s<|j|�r8||gSgStd�|j|��S(Ni����cSs|jdd�dj�S(NRi(Rtstrip(R�((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR�s(t	mimetoolsR�tMessageR}R�tgetallmatchingheaders(RuR�R�((s./usr/lib/python2.7/site-packages/rhn/rpclib.pytgetHeaderValuesxs	R�cBs8eZdZd�Zd�Zd�Zd�ZeZRS(s{ some magic to bind an XML-RPC method to an RPC server.
        supports "nested" methods (e.g. examples.getStateName)
    cCs||_||_dS(N(t_sendt_name(RCtsendR�((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyRQ�s	cCst|jd|j|f�S(Ns%s.%s(R�R�R�(RCR�((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR��scGs|j|j|�S(N(R�R�(RCR�((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyt__call__�scCsd|jj|j|jfS(Ns<%s %s (%s)>(R�R'R�R�(RC((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR��s(R'R(R�RQR�R�R�R�(((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR��s				R�cBs)eZdZd�Zd�Zd�ZRS(s;
    A "slicing method" allows for byte range requests
    cCs tj|||�d|_dS(N(R�RQRR�(RCR�R�((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyRQ�scCst|jd|j|f�S(Ns%s.%s(R�R�R�(RCR�((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR��scOs�|jd�|_|jd�|_y&|jjjd|jd|j�Wntk
r]nX|j|j|�}y|jjj�Wntk
r�nX|S(NR�R�(	RqR�R�R�tim_selfR�tAttributeErrorR�R�(RCR�R�R{((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR��s

(R'R(R�RQR�R�(((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyR��s		cCs�d}d}d}|j|�r4t||�}nd}|j|�r�t||�}|r�dj|�}ddl}d|j|�}q�n||fS(s% Reports the error from the headers. iR�sX-RHN-Fault-CodesX-RHN-Fault-Stringi����Ns%s(R}RtR�R�tbase64tdecodestring(RuR�terrmsgtst_sListt_sR�((s./usr/lib/python2.7/site-packages/rhn/rpclib.pytreportError�s(R2R�R�RRR�ttypesRRRRRRRR_R�R
R"R%R�R&R)R�R�R�R�R�R�R�R�(((s./usr/lib/python2.7/site-packages/rhn/rpclib.pyt<module>s,.		%	��^	


Zerion Mini Shell 1.0