AlkantarClanX12

Your IP : 3.15.34.50


Current Path : /proc/thread-self/root/opt/alt/python33/lib64/python3.3/urllib/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python33/lib64/python3.3/urllib/__pycache__/request.cpython-33.pyo

�
��f�qc'@s�dZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlmZmZmZddlmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'ddl(m)Z)m*Z*yddl+Z+Wne,k
r�e-Z.YnXe/Z.dddd	d
ddd
ddddddddddddddddddd d!d"d#d$gZ0ej1dd%�Z2e3a4d&e3d'e3d(e-e3ej5d)d�Z6d*d�Z7gZ8e3e3e3d+d!�Z9d,d"�Z:e
j;d-e
j<�Z=d.d/�Z>Gd0d�d�Z?Gd1d�d�Z@d2d�ZAGd3d�d�ZBGd4d�deB�ZCGd5d	�d	eB�ZDGd6d
�d
eB�ZEd7d8�ZFGd9d�deB�ZGGd:d
�d
�ZHGd;d�deH�ZIGd<d�d�ZJGd=d�deJeB�ZKGd>d�deJeB�ZLejMZNGd?d�d�ZOGd@d�deBeO�ZPGdAd�deBeO�ZQGdBdC�dCeB�ZRGdDd�deR�ZSeTejUdE�rYGdFdG�dGeR�ZVe0jWdG�nGdHd�deB�ZXGdId�deB�ZYdJdK�ZZdLdM�Z[GdNd�deB�Z\dOdP�Z]GdQd�deB�Z^GdRd�de^�Z_dSZ`ejadTkrddUlbmcZcmdZdndVd�ZcdWd�ZdiZeGdXd#�d#�ZfGdYd$�d$ef�Zge3ahdZd[�Zie3ajd\d]�Zke3ald^d_�Zme3and`da�ZoGdbdc�dc�Zpddde�Zqdfdg�Zrdhdi�Zsejtdjkr7ddklumvZvmwZwdldm�Zxdndo�Zydpdq�Zzdrd �Z{nNejadTkrydsdt�Z|dud �Z{dvdw�Z}dxdq�ZzneqZ{erZzdS(yu�
An extensible library for opening URLs using a variety of protocols

The simplest way to use this module is to call the urlopen function,
which accepts a string containing a URL or a Request object (described
below).  It opens the URL and returns the results as file-like
object; the returned object has some extra methods described below.

The OpenerDirector manages a collection of Handler objects that do
all the actual work.  Each Handler implements a particular protocol or
option.  The OpenerDirector is a composite object that invokes the
Handlers needed to open the requested URL.  For example, the
HTTPHandler performs HTTP GET and POST requests and deals with
non-error returns.  The HTTPRedirectHandler automatically deals with
HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler
deals with digest authentication.

urlopen(url, data=None) -- Basic usage is the same as original
urllib.  pass the url and optionally data to post to an HTTP URL, and
get a file-like object back.  One difference is that you can also pass
a Request instance instead of URL.  Raises a URLError (subclass of
IOError); for HTTP errors, raises an HTTPError, which can also be
treated as a valid response.

build_opener -- Function that creates a new OpenerDirector instance.
Will install the default handlers.  Accepts one or more Handlers as
arguments, either instances or Handler classes that it will
instantiate.  If one of the argument is a subclass of the default
handler, the argument will be installed instead of the default.

install_opener -- Installs a new opener as the default opener.

objects of interest:

OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages
the Handler classes, while dealing with requests and responses.

Request -- An object that encapsulates the state of a request.  The
state can be as simple as the URL.  It can also include extra HTTP
headers, e.g. a User-Agent.

BaseHandler --

internals:
BaseHandler and parent
_call_chain conventions

Example usage:

import urllib.request

# set up authentication info
authinfo = urllib.request.HTTPBasicAuthHandler()
authinfo.add_password(realm='PDQ Application',
                      uri='https://mahler:8092/site-updates.py',
                      user='klem',
                      passwd='geheim$parole')

proxy_support = urllib.request.ProxyHandler({"http" : "http://ahad-haam:3128"})

# build a new opener that adds authentication and caching FTP handlers
opener = urllib.request.build_opener(proxy_support, authinfo,
                                     urllib.request.CacheFTPHandler)

# install it
urllib.request.install_opener(opener)

f = urllib.request.urlopen('http://www.python.org/')
iN(uURLErroru	HTTPErroruContentTooShortError(uurlparseuurlsplituurljoinuunwrapuquoteuunquoteu	splittypeu	splithostu	splitportu	splituserusplitpasswdu	splitattru
splitqueryu
splitvalueusplittaguto_bytesu
urlunparse(u
addinfourluaddclosehookuRequestuOpenerDirectoruBaseHandleruHTTPDefaultErrorHandleruHTTPRedirectHandleruHTTPCookieProcessoruProxyHandleruHTTPPasswordMgruHTTPPasswordMgrWithDefaultRealmuAbstractBasicAuthHandleruHTTPBasicAuthHandleruProxyBasicAuthHandleruAbstractDigestAuthHandleruHTTPDigestAuthHandleruProxyDigestAuthHandleruHTTPHandleruFileHandleru
FTPHandleruCacheFTPHandleruUnknownHandleruHTTPErrorProcessoruurlopenuinstall_openerubuild_openerupathname2urluurl2pathnameu
getproxiesuurlretrieveu
urlcleanupu	URLopeneruFancyURLopeneriucafileucapathu	cadefaultc	Cs�|s|s|r�ts'td��ntjtj�}|jtjO_tj|_|sc|rv|j	||�n
|j
�td|dd�}t
|�}n"tdkr�t
�a}nt}|j|||�S(NuSSL support not availableucontextucheck_hostnameT(u	_have_sslu
ValueErrorusslu
SSLContextuPROTOCOL_SSLv23uoptionsuOP_NO_SSLv2u
CERT_REQUIREDuverify_modeuload_verify_locationsuset_default_verify_pathsuHTTPSHandleruTrueubuild_openeru_openeruNoneuopen(	uurludatautimeoutucafileucapathu	cadefaultucontextu
https_handleruopener((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuurlopen�s
cCs
|adS(N(u_opener(uopener((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuinstall_opener�scCs�t|�\}}tjt||���D}|j�}|dkrb|rbtjj|�|fS|rzt|d�}n(t	j
dd�}|j}t
j|�|��||f}	d
}
d}d}d}
d|kr�t|d	�}n|r||
|
|�nx\|j|
�}|s!Pn|t|�7}|j|�|
d7}
|r||
|
|�qqWd
QXWd
QX|dkr�||kr�td||f|	��n|	S(uW
    Retrieve a URL into a temporary location on disk.

    Requires a URL argument. If a filename is passed, it is used as
    the temporary file location. The reporthook argument should be
    a callable that accepts a block number, a read size, and the
    total file size of the URL target. The data argument should be
    valid URL encoded data.

    If a filename is passed and the URL points to a local resource,
    the result is a copy from local file to new file.

    Returns a tuple containing the path to the newly created
    data file as well as the resulting HTTPMessage object.
    ufileuwbudeleteiiiiucontent-lengthuContent-LengthNu1retrieval incomplete: got only %i out of %i bytesFi i����(u	splittypeu
contextlibuclosinguurlopenuinfouosupathunormpathuopenutempfileuNamedTemporaryFileuFalseunameu_url_tempfilesuappenduintureadulenuwriteuContentTooShortError(uurlufilenameu
reporthookudatauurl_typeupathufpuheadersutfpuresultubsusizeureadublocknumublock((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuurlretrieve�sD	


"cCsWx4tD],}ytj|�Wqtk
r2YqXqWtdd�=trSdandS(N(u_url_tempfilesuosuunlinkuEnvironmentErroru_openeruNone(u	temp_file((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
urlcleanup�s

	
u:\d+$cCsY|j}t|�d}|dkr:|jdd�}ntjd|d�}|j�S(u�Return request-host, as defined by RFC 2965.

    Variation from RFC: returned value is lowercased, for convenient
    comparison.

    iuuHost(ufull_urluurlparseu
get_headeru_cut_port_reusubulower(urequestuurluhost((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyurequest_host�s	urequest_hostcBs
|EeZdZd'id'd(d'dd�Zdd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd'd#d$�Zd%d&�Zd'S()uRequestc	Cs�t|�|_t|j�\|_|_||_i|_d|_x*|j�D]\}}|j	||�qRWi|_
|dkr�t|�}n||_||_
||_|j�dS(N(uunwrapufull_urlusplittagufragmentudatauheadersuNoneu_tunnel_hostuitemsu
add_headeruunredirected_hdrsurequest_hostuorigin_req_hostuunverifiableumethodu_parse(	uselfuurludatauheadersuorigin_req_hostuunverifiableumethodukeyuvalue((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__init__s							uRequest.__init__cCswt|j�\|_}|jdkr=td|j��nt|�\|_|_|jrst|j�|_ndS(Nuunknown url type: %r(	u	splittypeufull_urlutypeuNoneu
ValueErroru	splithostuhostuselectoruunquote(uselfurest((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu_parses	uRequest._parsecCs1|jdk	r|jS|jdk	r)dSdSdS(u3Return a string indicating the HTTP request method.uPOSTuGETN(umethoduNoneudata(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
get_methods
uRequest.get_methodcCs(|jrd|j|jfS|jSdS(Nu%s#%s(ufragmentufull_url(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuget_full_url&s	uRequest.get_full_urlcCs)d}tj|tdd�||_dS(Nu&Request.add_data method is deprecated.u
stackleveli(uwarningsuwarnuDeprecationWarningudata(uselfudataumsg((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuadd_data.suRequest.add_datacCs)d}tj|tdd�|jdk	S(Nu&Request.has_data method is deprecated.u
stackleveli(uwarningsuwarnuDeprecationWarningudatauNone(uselfumsg((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhas_data3suRequest.has_datacCs#d}tj|tdd�|jS(Nu&Request.get_data method is deprecated.u
stackleveli(uwarningsuwarnuDeprecationWarningudata(uselfumsg((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuget_data8suRequest.get_datacCs#d}tj|tdd�|jS(Nu&Request.get_type method is deprecated.u
stackleveli(uwarningsuwarnuDeprecationWarningutype(uselfumsg((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuget_type=suRequest.get_typecCs#d}tj|tdd�|jS(Nu&Request.get_host method is deprecated.u
stackleveli(uwarningsuwarnuDeprecationWarninguhost(uselfumsg((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuget_hostBsuRequest.get_hostcCs#d}tj|tdd�|jS(Nu*Request.get_selector method is deprecated.u
stackleveli(uwarningsuwarnuDeprecationWarninguselector(uselfumsg((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuget_selectorGsuRequest.get_selectorcCs#d}tj|tdd�|jS(Nu-Request.is_unverifiable method is deprecated.u
stackleveli(uwarningsuwarnuDeprecationWarninguunverifiable(uselfumsg((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuis_unverifiableLsuRequest.is_unverifiablecCs#d}tj|tdd�|jS(Nu1Request.get_origin_req_host method is deprecated.u
stackleveli(uwarningsuwarnuDeprecationWarninguorigin_req_host(uselfumsg((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuget_origin_req_hostQsuRequest.get_origin_req_hostcCsJ|jdkr(|jr(|j|_n||_|j|_||_dS(Nuhttps(utypeu_tunnel_hostuhostufull_urluselector(uselfuhostutype((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	set_proxyXs
	uRequest.set_proxycCs|j|jkS(N(uselectorufull_url(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	has_proxy`suRequest.has_proxycCs||j|j�<dS(N(uheadersu
capitalize(uselfukeyuval((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
add_headercsuRequest.add_headercCs||j|j�<dS(N(uunredirected_hdrsu
capitalize(uselfukeyuval((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuadd_unredirected_headergsuRequest.add_unredirected_headercCs||jkp||jkS(N(uheadersuunredirected_hdrs(uselfuheader_name((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
has_headerksuRequest.has_headercCs"|jj||jj||��S(N(uheadersugetuunredirected_hdrs(uselfuheader_nameudefault((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
get_headeros	uRequest.get_headercCs/|jj�}|j|j�t|j��S(N(uunredirected_hdrsucopyuupdateuheadersulistuitems(uselfuhdrs((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuheader_itemstsuRequest.header_itemsNF(u__name__u
__module__u__qualname__uNoneuFalseu__init__u_parseu
get_methoduget_full_urluadd_datauhas_datauget_datauget_typeuget_hostuget_selectoruis_unverifiableuget_origin_req_hostu	set_proxyu	has_proxyu
add_headeruadd_unredirected_headeru
has_headeru
get_headeruheader_items(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuRequests*	cBst|EeZdZdd�Zdd�Zdd�Zdd�Zdej	d	d
�Z
ddd�Zd
d�ZdS(uOpenerDirectorcCsMdt}d|fg|_g|_i|_i|_i|_i|_dS(NuPython-urllib/%su
User-agent(u__version__u
addheadersuhandlersuhandle_openuhandle_erroruprocess_responseuprocess_request(uselfuclient_version((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__init__zs
				uOpenerDirector.__init__cCs�t|d�s(tdt|���nd}xxt|�D]j}|d
krSq;n|jd�}|d|�}||dd�}|jd�r
|jd�|d}||dd�}yt|�}Wntk
r�YnX|j	j
|i�}	|	|j	|<n]|d	kr(|}|j}	n?|d
krF|}|j}	n!|dkr;|}|j
}	nq;|	j|g�}
|
r�tj|
|�n
|
j|�d}q;W|r�tj|j|�|j|�ndS(Nu
add_parentu%expected BaseHandler instance, got %ruredirect_requestudo_openu
proxy_openu_iuerroruopenuresponseurequestF(uredirect_requestudo_openu
proxy_openT(uhasattru	TypeErrorutypeuFalseudirufindu
startswithuintu
ValueErroruhandle_errorugetuhandle_openuprocess_responseuprocess_requestu
setdefaultubisectuinsortuappenduTrueuhandlersu
add_parent(uselfuhandleruaddedumethuiuprotocolu	conditionujukindulookupuhandlers((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuadd_handler�sJ


uOpenerDirector.add_handlercCsdS(N((uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuclose�suOpenerDirector.closec	GsR|j|f�}x9|D]1}t||�}||�}|dk	r|SqWdS(N(ugetugetattruNone(	uselfuchainukindu	meth_nameuargsuhandlersuhandlerufuncuresult((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu_call_chain�s
uOpenerDirector._call_chainc
Cs�t|t�r!t||�}n|}|dk	r?||_n||_|j}|d}x8|jj|g�D]!}t	||�}||�}qqW|j
||�}	|d}x;|jj|g�D]$}t	||�}|||	�}	q�W|	S(Nu_requestu	_response(u
isinstanceustruRequestuNoneudatautimeoututypeuprocess_requestugetugetattru_openuprocess_response(
uselfufullurludatautimeouturequprotocolu	meth_nameu	processorumethuresponse((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuopen�s"		

uOpenerDirector.opencCsp|j|jdd|�}|r%|S|j}|j|j||d|�}|rW|S|j|jdd|�S(Nudefaultudefault_openu_openuunknownuunknown_open(u_call_chainuhandle_openutype(uselfurequdatauresultuprotocol((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu_open�s	
uOpenerDirector._opencGs�|d
kr<|jd}|d}d|}d}|}n|j}|d}d}|||f|}|j|�}|r�|S|r�|dd	f|}|j|�SdS(Nuhttpuhttpsiu
http_error_%siu_erroriudefaultuhttp_error_default(uhttpuhttps(uhandle_erroru_call_chain(uselfuprotouargsudictu	meth_nameuhttp_erru	orig_argsuresult((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuerror�s 


		
uOpenerDirector.errorN(
u__name__u
__module__u__qualname__u__init__uadd_handlerucloseu_call_chainuNoneusocketu_GLOBAL_DEFAULT_TIMEOUTuopenu_openuerror(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuOpenerDirectorys/cGsFdd�}t�}ttttttttg}t	t
jd�rU|jt
�nt�}xl|D]d}x[|D]S}||�r�t||�r�|j|�q�qrt||�rr|j|�qrqrWqeWx|D]}|j|�q�Wx|D]}|j|��q�Wx3|D]+}||�r1|�}n|j|�qW|S(u*Create an opener object from a list of handlers.

    The opener will use several default handlers, including support
    for HTTP, FTP and when applicable HTTPS.

    If any of the handlers passed as arguments are subclasses of the
    default handlers, the default handlers will not be used.
    cSst|t�pt|d�S(Nu	__bases__(u
isinstanceutypeuhasattr(uobj((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuisclasssubuild_opener.<locals>.isclassuHTTPSConnection(uOpenerDirectoruProxyHandleruUnknownHandleruHTTPHandleruHTTPDefaultErrorHandleruHTTPRedirectHandleru
FTPHandleruFileHandleruHTTPErrorProcessoruhasattruhttpuclientuappenduHTTPSHandlerusetu
issubclassuaddu
isinstanceuremoveuadd_handler(uhandlersuisclassuopenerudefault_classesuskipuklassucheckuh((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyubuild_openers0				




cBs>|EeZdZdZdd�Zdd�Zdd�ZdS(	uBaseHandleri�cCs
||_dS(N(uparent(uselfuparent((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
add_parent0suBaseHandler.add_parentcCsdS(N((uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuclose3suBaseHandler.closecCs#t|d�sdS|j|jkS(Nu
handler_orderT(uhasattruTrueu
handler_order(uselfuother((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__lt__7suBaseHandler.__lt__N(u__name__u
__module__u__qualname__u
handler_orderu
add_parentucloseu__lt__(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuBaseHandler-scBs2|EeZdZdZdZdd�ZeZdS(uHTTPErrorProcessoruProcess HTTP error responses.i�cCsd|j|j|j�}}}d|ko7dkns`|jjd|||||�}n|S(Ni�i,uhttp(ucodeumsguinfouparentuerror(uselfurequesturesponseucodeumsguhdrs((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
http_responseDs
 	u HTTPErrorProcessor.http_responseN(u__name__u
__module__u__qualname__u__doc__u
handler_orderu
http_responseuhttps_response(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuHTTPErrorProcessor@scBs |EeZdZdd�ZdS(uHTTPDefaultErrorHandlercCst|j||||��dS(N(u	HTTPErrorufull_url(uselfurequfpucodeumsguhdrs((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_defaultRsu*HTTPDefaultErrorHandler.http_error_defaultN(u__name__u
__module__u__qualname__uhttp_error_default(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuHTTPDefaultErrorHandlerQscBsL|EeZdZdZdZdd�Zdd�ZeZZZ	dZ
dS(	uHTTPRedirectHandlerii
c	s�|j�}|dkr$|dkp9|dko9|dksZt|j||||��n|jdd	�}d�t�fdd
�|jj�D��}t|d|d|jdd�S(u�Return a Request or None in response to a redirect.

        This is called by the http_error_30x methods when a
        redirection response is received.  If a redirection should
        take place, return a new Request to allow http_error_30x to
        perform the redirect.  Otherwise, raise HTTPError if no-one
        else should try to handle this url.  Return None if you can't
        but another Handler might.
        i-i.i/i3uGETuHEADuPOSTu u%20ucontent-lengthucontent-typec3s3|])\}}|j��kr||fVqdS(N(ulower(u.0ukuv(uCONTENT_HEADERS(u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	<genexpr>ts	u7HTTPRedirectHandler.redirect_request.<locals>.<genexpr>uheadersuorigin_req_hostuunverifiable(i-i.i/i3(uGETuHEAD(i-i.i/(ucontent-lengthucontent-typeT(
u
get_methodu	HTTPErrorufull_urlureplaceudictuheadersuitemsuRequestuorigin_req_hostuTrue(	uselfurequfpucodeumsguheadersunewurlumu
newheaders((uCONTENT_HEADERSu3/opt/alt/python33/lib64/python3.3/urllib/request.pyuredirect_request]s
(		u$HTTPRedirectHandler.redirect_requestc
Cs�d|kr|d}nd|kr2|d}ndSt|�}|jdkrvt||d||f||��n|js�t|�}d|d	<nt|�}t|j|�}|j||||||�}|dkr�dSt
|d
�r[|j}	|_|	j|d�|j
ks3t|	�|jkrot|j||j|||��qoni}	|_|_|	j|d�d|	|<|j�|j�|jj|d
|j�S(Nulocationuuriuhttpuhttpsuftpuu+%s - Redirection to url '%s' is not allowedu/iu
redirect_dictiiutimeout(uhttpuhttpsuftpu(uurlparseuschemeu	HTTPErrorupathulistu
urlunparseuurljoinufull_urluredirect_requestuNoneuhasattru
redirect_dictugetumax_repeatsulenumax_redirectionsuinf_msgureaducloseuparentuopenutimeout(
uselfurequfpucodeumsguheadersunewurluurlpartsunewuvisited((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_302s<


	


u"HTTPRedirectHandler.http_error_302uoThe HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
N(u__name__u
__module__u__qualname__umax_repeatsumax_redirectionsuredirect_requestuhttp_error_302uhttp_error_301uhttp_error_303uhttp_error_307uinf_msg(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuHTTPRedirectHandlerUs"7c	Cs�t|�\}}|jd�s0d}|}nY|jd�sRtd|��n|jdd�}|dkryd}n|d|�}t|�\}}|dk	r�t|�\}}n
d}}||||fS(u3Return (scheme, user, password, host/port) given a URL or an authority.

    If a URL is supplied, it must have an authority (host:port) component.
    According to RFC 3986, having an authority component means the URL must
    have two slashes after the scheme:

    >>> _parse_proxy('file:/ftp.example.com/')
    Traceback (most recent call last):
    ValueError: proxy URL with no authority: 'file:/ftp.example.com/'

    The first three items of the returned tuple may be None.

    Examples of authority parsing:

    >>> _parse_proxy('proxy.example.com')
    (None, None, None, 'proxy.example.com')
    >>> _parse_proxy('proxy.example.com:3128')
    (None, None, None, 'proxy.example.com:3128')

    The authority component may optionally include userinfo (assumed to be
    username:password):

    >>> _parse_proxy('joe:password@proxy.example.com')
    (None, 'joe', 'password', 'proxy.example.com')
    >>> _parse_proxy('joe:password@proxy.example.com:3128')
    (None, 'joe', 'password', 'proxy.example.com:3128')

    Same examples, but with URLs instead:

    >>> _parse_proxy('http://proxy.example.com/')
    ('http', None, None, 'proxy.example.com')
    >>> _parse_proxy('http://proxy.example.com:3128/')
    ('http', None, None, 'proxy.example.com:3128')
    >>> _parse_proxy('http://joe:password@proxy.example.com/')
    ('http', 'joe', 'password', 'proxy.example.com')
    >>> _parse_proxy('http://joe:password@proxy.example.com:3128')
    ('http', 'joe', 'password', 'proxy.example.com:3128')

    Everything after the authority is ignored:

    >>> _parse_proxy('ftp://joe:password@proxy.example.com/rubbish:3128')
    ('ftp', 'joe', 'password', 'proxy.example.com')

    Test for no trailing '/' case:

    >>> _parse_proxy('http://joe:password@proxy.example.com')
    ('http', 'joe', 'password', 'proxy.example.com')

    u/u//uproxy URL with no authority: %riiNi����(u	splittypeu
startswithuNoneu
ValueErrorufindu	splituserusplitpasswd(	uproxyuschemeur_schemeu	authorityuenduuserinfouhostportuuserupassword((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu_parse_proxy�s2		
u_parse_proxycBs5|EeZdZdZddd�Zdd�ZdS(uProxyHandleridc	Csh|dkrt�}n||_x@|j�D]2\}}t|d||||jdd��q.WdS(Nu%s_opencSs||||�S(N((uruproxyutypeumeth((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu<lambda>su'ProxyHandler.__init__.<locals>.<lambda>(uNoneu
getproxiesuproxiesuitemsusetattru
proxy_open(uselfuproxiesutypeuurl((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__init__	s	
uProxyHandler.__init__cCs|j}t|�\}}}}|dkr6|}n|jrRt|j�rRdS|r�|r�dt|�t|�f}	tj|	j��j	d�}
|j
dd|
�nt|�}|j||�||ks�|dkr�dS|jj
|d|j�SdS(Nu%s:%suasciiuProxy-authorizationuBasic uhttpsutimeout(utypeu_parse_proxyuNoneuhostuproxy_bypassuunquoteubase64u	b64encodeuencodeudecodeu
add_headeru	set_proxyuparentuopenutimeout(uselfurequproxyutypeu	orig_typeu
proxy_typeuuserupassworduhostportu	user_passucreds((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
proxy_opens 		uProxyHandler.proxy_openN(u__name__u
__module__u__qualname__u
handler_orderuNoneu__init__u
proxy_open(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuProxyHandlers
cBsS|EeZdZdd�Zdd�Zdd�Zddd�Zd	d
�ZdS(
uHTTPPasswordMgrcCs
i|_dS(N(upasswd(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__init__1suHTTPPasswordMgr.__init__cs�t|t�r|g}n|�jkr:i�j|<nxGdD]?�t��fdd�|D��}||f�j||<qAWdS(Ncs"g|]}�j|���qS((u
reduce_uri(u.0uu(udefault_portuself(u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
<listcomp><s	u0HTTPPasswordMgr.add_password.<locals>.<listcomp>TF(TF(u
isinstanceustrupasswduTrueuFalseutuple(uselfurealmuuriuuserupasswdureduced_uri((udefault_portuselfu3/opt/alt/python33/lib64/python3.3/urllib/request.pyuadd_password4s
uHTTPPasswordMgr.add_passwordc	Cs�|jj|i�}xddD]\}|j||�}xA|j�D]3\}}x$|D]}|j||�rT|SqTWqAWqWdS(NTF(TF(NN(upasswdugetuTrueuFalseu
reduce_uriuitemsu	is_suburiuNone(	uselfurealmuauthuriudomainsudefault_portureduced_authuriuurisuauthinfouuri((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyufind_user_password?s

u"HTTPPasswordMgr.find_user_passwordc
Cs�t|�}|dr=|d}|d}|dp7d}nd
}|}d}t|�\}}|r�|d
kr�|d
k	r�idd6dd6j|�}	|	d
k	r�d	||	f}q�n||fS(u@Accept authority or URI and extract only the authority and path.iiiu/iPuhttpi�uhttpsu%s:%dN(uurlsplituNoneu	splitportuget(
uselfuuriudefault_portupartsuschemeu	authorityupathuhostuportudport((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
reduce_uriIs 




	uHTTPPasswordMgr.reduce_uricCsi||krdS|d|dkr(dStj|d|df�}t|�t|d�kredSdS(ucCheck if test is below base in a URI tree

        Both args must be URIs in reduced form.
        iiTF(uTrueuFalseu	posixpathucommonprefixulen(uselfubaseutestucommon((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	is_suburi`suHTTPPasswordMgr.is_suburiNT(	u__name__u
__module__u__qualname__u__init__uadd_passwordufind_user_passworduTrueu
reduce_uriu	is_suburi(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuHTTPPasswordMgr/s

cBs |EeZdZdd�ZdS(uHTTPPasswordMgrWithDefaultRealmcCsDtj|||�\}}|dk	r1||fStj|d|�S(N(uHTTPPasswordMgrufind_user_passworduNone(uselfurealmuauthuriuuserupassword((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyufind_user_passwordqs

u2HTTPPasswordMgrWithDefaultRealm.find_user_passwordN(u__name__u
__module__u__qualname__ufind_user_password(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuHTTPPasswordMgrWithDefaultRealmoscBs\|EeZdZejdej�Zd
dd�Zdd�Z	dd�Z
dd	�Zd
S(uAbstractBasicAuthHandleru1(?:.*,)*[ 	]*([^ 	]+)[ 	]+realm=(["']?)([^"']*)\2cCs=|dkrt�}n||_|jj|_d|_dS(Ni(uNoneuHTTPPasswordMgrupasswduadd_passworduretried(uselfupassword_mgr((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__init__�s
	u!AbstractBasicAuthHandler.__init__cCs
d|_dS(Ni(uretried(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyureset_retry_count�su*AbstractBasicAuthHandler.reset_retry_countc
Cs1|j|d�}|jdkrBt|j�dd|d��n|jd7_|r-|j�d}|j�dkr�td|��q-tj	j
|�}|r-|j�\}}}|dkr�tj
d
td�n|j�dkr*|j|||�}	|	r#|	jdkr#d|_n|	Sq-ndS(
Nii�ubasic auth failediiubasicuDAbstractBasicAuthHandler does not support the following scheme: '%s'u"u'uBasic Auth Realm was unquotedi(u"u'(ugetuNoneuretriedu	HTTPErroruget_full_urlusplituloweru
ValueErroruAbstractBasicAuthHandlerurxusearchugroupsuwarningsuwarnuUserWarninguretry_http_basic_authucode(
uselfuauthrequhosturequheadersuschemeumouquoteurealmuresponse((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_auth_reqed�s*
	
u.AbstractBasicAuthHandler.http_error_auth_reqedcCs�|jj||�\}}|dk	r�d||f}dtj|j��jd�}|jj|j	d�|kr{dS|j
|j	|�|jj|d|j
�SdSdS(Nu%s:%suBasic uasciiutimeout(upasswdufind_user_passworduNoneubase64u	b64encodeuencodeudecodeuheadersugetuauth_headeruadd_unredirected_headeruparentuopenutimeout(uselfuhosturequrealmuuserupwurawuauth((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuretry_http_basic_auth�s"u.AbstractBasicAuthHandler.retry_http_basic_authN(u__name__u
__module__u__qualname__ureucompileuIurxuNoneu__init__ureset_retry_countuhttp_error_auth_reqeduretry_http_basic_auth(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuAbstractBasicAuthHandlerys	 cBs&|EeZdZdZdd�ZdS(uHTTPBasicAuthHandleru
AuthorizationcCs/|j}|jd|||�}|j�|S(Nuwww-authenticate(ufull_urluhttp_error_auth_reqedureset_retry_count(uselfurequfpucodeumsguheadersuurluresponse((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_401�s
		
u#HTTPBasicAuthHandler.http_error_401N(u__name__u
__module__u__qualname__uauth_headeruhttp_error_401(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuHTTPBasicAuthHandler�scBs&|EeZdZdZdd�ZdS(uProxyBasicAuthHandleruProxy-authorizationcCs/|j}|jd|||�}|j�|S(Nuproxy-authenticate(uhostuhttp_error_auth_reqedureset_retry_count(uselfurequfpucodeumsguheadersu	authorityuresponse((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_407�s
		
u$ProxyBasicAuthHandler.http_error_407N(u__name__u
__module__u__qualname__uauth_headeruhttp_error_407(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuProxyBasicAuthHandler�scBsw|EeZdZddd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS(uAbstractDigestAuthHandlercCsO|dkrt�}n||_|jj|_d|_d|_d|_dS(Ni(uNoneuHTTPPasswordMgrupasswduadd_passworduretriedunonce_countu
last_nonce(uselfupasswd((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__init__�s			u"AbstractDigestAuthHandler.__init__cCs
d|_dS(Ni(uretried(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyureset_retry_count�su+AbstractDigestAuthHandler.reset_retry_countcCs�|j|d�}|jdkr?t|jdd|d��n|jd7_|r�|j�d}|j�dkr�|j||�S|j�dkr�td|��q�ndS(	Nii�udigest auth failediiudigestubasicuEAbstractDigestAuthHandler does not support the following scheme: '%s'(	ugetuNoneuretriedu	HTTPErrorufull_urlusplituloweruretry_http_digest_authu
ValueError(uselfuauth_headeruhosturequheadersuauthrequscheme((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_auth_reqed�su/AbstractDigestAuthHandler.http_error_auth_reqedcCs�|jdd�\}}ttdt|���}|j||�}|r�d|}|jj|jd�|krwdS|j	|j|�|j
j|d|j�}|SdS(Nu iu	Digest %sutimeout(
usplituparse_keqv_listufilteruNoneuparse_http_listuget_authorizationuheadersugetuauth_headeruadd_unredirected_headeruparentuopenutimeout(uselfurequauthutokenu	challengeuchaluauth_valuresp((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuretry_http_digest_auth	s
u0AbstractDigestAuthHandler.retry_http_digest_authcCsXd|j|tj�f}|jd�td�}tj|�j�}|dd�S(Nu	%s:%s:%s:uasciiii(unonce_countutimeuctimeuencodeu_randombytesuhashlibusha1u	hexdigest(uselfunonceusubudig((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
get_cnoncesu$AbstractDigestAuthHandler.get_cnoncecCs_yK|d}|d}|jd�}|jdd�}|jdd�}Wntk
rcdSYnX|j|�\}}	|dkr�dS|jj||j�\}
}|
dkr�dS|jdk	r�|j|j|�}nd}d|
||f}
d|j	�|j
f}|d	kr�||jkr=|jd
7_nd
|_||_d|j}|j
|�}d||||||�f}|	||
�|�}nD|dkr�|	||
�d|||�f�}ntd
|��d|
|||j
|f}|r|d|7}n|r0|d|7}n|d|7}|r[|d||f7}n|S(Nurealmunonceuqopu	algorithmuMD5uopaqueu%s:%s:%su%s:%suauthiu%08xu%s:%s:%s:%s:%suqop '%s' is not supported.u>username="%s", realm="%s", nonce="%s", uri="%s", response="%s"u
, opaque="%s"u
, digest="%s"u, algorithm="%s"u, qop=auth, nc=%s, cnonce="%s"(ugetuNoneuKeyErroruget_algorithm_implsupasswdufind_user_passwordufull_urludatauget_entity_digestu
get_methoduselectoru
last_nonceunonce_countu
get_cnonceuURLError(uselfurequchalurealmunonceuqopu	algorithmuopaqueuHuKDuuserupwuentdiguA1uA2uncvalueucnonceunoncebiturespdigubase((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuget_authorization sV


	
		
(
u+AbstractDigestAuthHandler.get_authorizationcsR|dkrdd��n|dkr6dd��n�fdd�}�|fS(NuMD5cSstj|jd��j�S(Nuascii(uhashlibumd5uencodeu	hexdigest(ux((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu<lambda>_su?AbstractDigestAuthHandler.get_algorithm_impls.<locals>.<lambda>uSHAcSstj|jd��j�S(Nuascii(uhashlibusha1uencodeu	hexdigest(ux((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu<lambda>ascs�d||f�S(Nu%s:%s((usud(uH(u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu<lambda>cs((uselfu	algorithmuKD((uHu3/opt/alt/python33/lib64/python3.3/urllib/request.pyuget_algorithm_impls\su-AbstractDigestAuthHandler.get_algorithm_implscCsdS(N(uNone(uselfudatauchal((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuget_entity_digestfsu+AbstractDigestAuthHandler.get_entity_digestN(u__name__u
__module__u__qualname__uNoneu__init__ureset_retry_countuhttp_error_auth_reqeduretry_http_digest_authu
get_cnonceuget_authorizationuget_algorithm_implsuget_entity_digest(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuAbstractDigestAuthHandler�s	<
cBs2|EeZdZdZdZdZdd�ZdS(uHTTPDigestAuthHandleru�An authentication protocol defined by RFC 2069

    Digest authentication improves on basic authentication because it
    does not transmit passwords in the clear.
    u
Authorizationi�cCs9t|j�d}|jd|||�}|j�|S(Niuwww-authenticate(uurlparseufull_urluhttp_error_auth_reqedureset_retry_count(uselfurequfpucodeumsguheadersuhosturetry((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_401us
	
u$HTTPDigestAuthHandler.http_error_401N(u__name__u
__module__u__qualname__u__doc__uauth_headeru
handler_orderuhttp_error_401(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuHTTPDigestAuthHandlerkscBs,|EeZdZdZdZdd�ZdS(uProxyDigestAuthHandleruProxy-Authorizationi�cCs/|j}|jd|||�}|j�|S(Nuproxy-authenticate(uhostuhttp_error_auth_reqedureset_retry_count(uselfurequfpucodeumsguheadersuhosturetry((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_407�s
		
u%ProxyDigestAuthHandler.http_error_407N(u__name__u
__module__u__qualname__uauth_headeru
handler_orderuhttp_error_407(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuProxyDigestAuthHandler}scBsG|EeZdZddd�Zdd�Zdd�Zdd	�Zd
S(uAbstractHTTPHandlericCs
||_dS(N(u_debuglevel(uselfu
debuglevel((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__init__�suAbstractHTTPHandler.__init__cCs
||_dS(N(u_debuglevel(uselfulevel((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuset_http_debuglevel�su'AbstractHTTPHandler.set_http_debuglevelc
Cs�|j}|std��n|jdk	r|j}t|t�rZd}t|��n|jd�s||jdd�n|jd�syt	|�}WnCtk
r�t|t
j�r�tdt
|�|f��nYqX|jddt|�|j�qn|}|j�rDt|j�\}}t|�\}}	n|jd�sf|jd|�nxH|jjD]:\}
}|
j�}
|j|
�ss|j|
|�qsqsW|S(	Nu
no host givenuLPOST data should be bytes or an iterable of bytes. It cannot be of type str.uContent-typeu!application/x-www-form-urlencodeduContent-lengthuBContent-Length should be specified for iterable data of type %r %ru%duHost(uhostuURLErrorudatauNoneu
isinstanceustru	TypeErroru
has_headeruadd_unredirected_headeru
memoryviewucollectionsuIterableu
ValueErrorutypeulenuitemsizeu	has_proxyu	splittypeuselectoru	splithostuparentu
addheadersu
capitalize(uselfurequestuhostudataumsgumvusel_hostuschemeuselusel_pathunameuvalue((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyudo_request_�sB		

	!uAbstractHTTPHandler.do_request_c
s�|j}|std��n||d|j|�}t|j���jt�fdd�|jj�D���d�d<tdd��j�D���|jr�i}d}|�kr��|||<�|=n|j	|jd	|�ny&|j
|j�|j|j
��Wn>tjk
rU}z|j�t|��WYd
d
}~Xn/X|j�}	|jr�|jj�d
|_n|j�|	_|	j|	_|	S(u�Return an HTTPResponse object for the request, using http_class.

        http_class must implement the HTTPConnection API from http.client.
        u
no host givenutimeoutc3s-|]#\}}|�kr||fVqdS(N((u.0ukuv(uheaders(u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	<genexpr>�s	u.AbstractHTTPHandler.do_open.<locals>.<genexpr>ucloseu
Connectioncss'|]\}}|j�|fVqdS(N(utitle(u.0unameuval((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	<genexpr>�suProxy-AuthorizationuheadersN(uhostuURLErrorutimeoutudictuunredirected_hdrsuupdateuheadersuitemsu_tunnel_hostu
set_tunnelurequestu
get_methoduselectorudatausocketuerrorucloseugetresponseusockuNoneuget_full_urluurlureasonumsg(
uselfu
http_classurequhttp_conn_argsuhostuhutunnel_headersuproxy_auth_hdruerrur((uheadersu3/opt/alt/python33/lib64/python3.3/urllib/request.pyudo_open�s6	/
	
&
	
uAbstractHTTPHandler.do_openN(u__name__u
__module__u__qualname__u__init__uset_http_debugleveludo_request_udo_open(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuAbstractHTTPHandler�s(uAbstractHTTPHandlercBs)|EeZdZdd�ZejZdS(uHTTPHandlercCs|jtjj|�S(N(udo_openuhttpuclientuHTTPConnection(uselfureq((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	http_open�suHTTPHandler.http_openN(u__name__u
__module__u__qualname__u	http_openuAbstractHTTPHandlerudo_request_uhttp_request(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuHTTPHandler�suHTTPSConnectioncBs>|EeZdZddddd�Zdd�ZejZdS(uHTTPSHandlericCs&tj||�||_||_dS(N(uAbstractHTTPHandleru__init__u_contextu_check_hostname(uselfu
debuglevelucontextucheck_hostname((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__init__s	uHTTPSHandler.__init__cCs(|jtjj|d|jd|j�S(Nucontextucheck_hostname(udo_openuhttpuclientuHTTPSConnectionu_contextu_check_hostname(uselfureq((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
https_opensuHTTPSHandler.https_openN(	u__name__u
__module__u__qualname__uNoneu__init__u
https_openuAbstractHTTPHandlerudo_request_u
https_request(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuHTTPSHandlersuHTTPSHandlercBsG|EeZdZddd�Zdd�Zdd�ZeZeZdS(uHTTPCookieProcessorcCs7ddl}|dkr*|jj�}n||_dS(Ni(uhttp.cookiejaruNoneu	cookiejaru	CookieJar(uselfu	cookiejaruhttp((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__init__suHTTPCookieProcessor.__init__cCs|jj|�|S(N(u	cookiejaruadd_cookie_header(uselfurequest((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_requestsu HTTPCookieProcessor.http_requestcCs|jj||�|S(N(u	cookiejaruextract_cookies(uselfurequesturesponse((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
http_responsesu!HTTPCookieProcessor.http_responseN(	u__name__u
__module__u__qualname__uNoneu__init__uhttp_requestu
http_responseu
https_requestuhttps_response(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuHTTPCookieProcessors
cBs |EeZdZdd�ZdS(uUnknownHandlercCs|j}td|��dS(Nuunknown url type: %s(utypeuURLError(uselfurequtype((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuunknown_open"s	uUnknownHandler.unknown_openN(u__name__u
__module__u__qualname__uunknown_open(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuUnknownHandler!scCspi}xc|D][}|jdd�\}}|ddkr^|ddkr^|dd�}n|||<q
W|S(u>Parse list of key=value strings where keys are not duplicated.u=iiu"i����i����(usplit(uluparsedueltukuv((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuparse_keqv_list&s
 uparse_keqv_listcCs�g}d}d}}x�|D]�}|r?||7}d}qn|r�|dkr]d}qn|dkrrd}n||7}qn|dkr�|j|�d}qn|dkr�d}n||7}qW|r�|j|�ndd�|D�S(	upParse lists as described by RFC 2068 Section 2.

    In particular, parse comma-separated lists where the elements of
    the list may include quoted-strings.  A quoted-string could
    contain a comma.  A non-quoted string could have quotes in the
    middle.  Neither commas nor quotes count if they are escaped.
    Only double-quotes count, not single-quotes.
    uu\u"u,cSsg|]}|j��qS((ustrip(u.0upart((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
<listcomp>Ys	u#parse_http_list.<locals>.<listcomp>FT(uFalseuTrueuappend(usuresupartuescapeuquoteucur((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuparse_http_list0s4	


	

	uparse_http_listcBs>|EeZdZdd�ZdZdd�Zdd�ZdS(uFileHandlercCs�|j}|dd�dkrt|dd�dkrt|jrt|jdkrt|j|j�k	r�td��q�n
|j|�SdS(Niu//iu/u	localhostu-file:// scheme is supported only on localhost(uselectoruhostu	get_namesuURLErroruopen_local_file(uselfurequurl((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	file_open]s	5uFileHandler.file_opencCs}tjdkrvy7ttjd�dtjtj��d�t_Wqvtjk
rrtjd�ft_YqvXntjS(Nu	localhosti(	uFileHandlerunamesuNoneutupleusocketugethostbyname_exugethostnameugaierroru
gethostbyname(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	get_nameshs$uFileHandler.get_namescCsaddl}ddl}|j}|j}t|�}y�tj|�}|j}|jj	|j
dd�}	|j|�d}
|j
d|
p�d||	f�}|r�t|�\}}n|s�|rt|�|j�kr|r�d||}
n
d|}
tt|d�||
�SWn1tk
rP}zt|��WYdd}~XnXtd��dS(	Niuusegmtu6Content-type: %s
Content-length: %d
Last-modified: %s
u
text/plainufile://urbufile not on local hostT(uemail.utilsu	mimetypesuhostuselectoruurl2pathnameuosustatust_sizeuutilsu
formatdateust_mtimeuTrueu
guess_typeumessage_from_stringu	splitportu_safe_gethostbynameu	get_namesu
addinfourluopenuOSErroruURLError(uselfurequemailu	mimetypesuhostufilenameu	localfileustatsusizeumodifiedumtypeuheadersuportuorigurluexp((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuopen_local_filess0			
uFileHandler.open_local_fileN(u__name__u
__module__u__qualname__u	file_openuNoneunamesu	get_namesuopen_local_file(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuFileHandler[s
cCs1ytj|�SWntjk
r,dSYnXdS(N(usocketu
gethostbynameugaierroruNone(uhost((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu_safe_gethostbyname�su_safe_gethostbynamecBs,|EeZdZdd�Zdd�ZdS(u
FTPHandlerc"Cs�ddl}ddl}|j}|s6td��nt|�\}}|dkr`|j}nt|�}t|�\}}|r�t	|�\}}nd}t
|�}|p�d}|p�d}ytj|�}Wn4tj
k
r}zt|��WYdd}~XnXt|j�\}	}
|	jd�}ttt
|��}|dd�|d}}|r�|dr�|dd�}ny|j||||||j�}
|r�dp�d}xM|
D]E}t|�\}}|j�dkr�|dkr�|j�}q�q�W|
j||�\}}d}|j|j�d}|rV|d
|7}n|dk	r|dkr|d|7}ntj|�}t|||j�SWnQ|jk
r�}z.td|�}|jt j!�d��WYdd}~XnXdS(Niuftp error: no host givenuu/iuIuDutypeuauAuiuduContent-type: %s
uContent-length: %d
u
ftp error: %rii����i����(uauAuiuIuduD("uftplibu	mimetypesuhostuURLErroru	splitportuNoneuFTP_PORTuintu	splituserusplitpasswduunquoteusocketu
gethostbynameuerroru	splitattruselectorusplitulistumapuconnect_ftputimeoutu
splitvalueuloweruupperuretrfileu
guess_typeufull_urluemailumessage_from_stringu
addinfourlu
all_errorsuwith_tracebackusysuexc_info(uselfurequftplibu	mimetypesuhostuportuuserupasswdumsgupathuattrsudirsufileufwutypeuattruvalueufpuretrlenuheadersumtypeuexpuexc((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuftp_open�s\	!
uFTPHandler.ftp_openc	Cst||||||dd�S(Nu
persistentF(u
ftpwrapperuFalse(uselfuuserupasswduhostuportudirsutimeout((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuconnect_ftp�suFTPHandler.connect_ftpN(u__name__u
__module__u__qualname__uftp_openuconnect_ftp(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
FTPHandler�s5cBs\|EeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S(uCacheFTPHandlercCs1i|_i|_d|_d|_d|_dS(Nii<i(ucacheutimeoutusoonestudelayu	max_conns(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__init__�s
				uCacheFTPHandler.__init__cCs
||_dS(N(udelay(uselfut((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
setTimeout�suCacheFTPHandler.setTimeoutcCs
||_dS(N(u	max_conns(uselfum((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyusetMaxConns�suCacheFTPHandler.setMaxConnscCs�|||dj|�|f}||jkrJtj�|j|j|<n<t||||||�|j|<tj�|j|j|<|j�|j|S(Nu/(ujoinucacheutimeudelayutimeoutu
ftpwrapperucheck_cache(uselfuuserupasswduhostuportudirsutimeoutukey((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuconnect_ftp�s
uCacheFTPHandler.connect_ftpcCs tj�}|j|krxxZt|jj��D]@\}}||kr1|j|j�|j|=|j|=q1q1Wntt|jj���|_t	|j�|j
krxJt|jj��D]3\}}||jkr�|j|=|j|=Pq�q�Wtt|jj���|_ndS(N(utimeusoonestulistutimeoutuitemsucacheucloseuminuvaluesulenu	max_conns(uselfutukuv((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyucheck_cache�s"
"

uCacheFTPHandler.check_cachecCsBx!|jj�D]}|j�qW|jj�|jj�dS(N(ucacheuvaluesucloseuclearutimeout(uselfuconn((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuclear_cache�s
uCacheFTPHandler.clear_cacheN(	u__name__u
__module__u__qualname__u__init__u
setTimeoutusetMaxConnsuconnect_ftpucheck_cacheuclear_cache(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuCacheFTPHandler�si
unt(uurl2pathnameupathname2urlcCs
t|�S(uOS-specific conversion from a relative URL of the 'file' scheme
        to a file system path; not recommended for general use.(uunquote(upathname((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuurl2pathname
scCs
t|�S(uOS-specific conversion from a file system path to a relative URL
        of the 'file' scheme; not recommended for general use.(uquote(upathname((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyupathname2urlscBs8|EeZdZdZd)ZdeZd)dd�Zdd�Z	dd�Z
d	d
�Zdd�Zd)d
d�Z
d)dd�Zd)dd�Zd)d)d)dd�Zdd�Zd)dd�Zd)dd�Zdd�Zerdd�Zd)dd �Znd!d"�Zd#d$�Zd%d&�Zd)d'd(�Zd)S(*u	URLopeneru,Class to open URLs.
    This is a class rather than just a subroutine because we may need
    more than one set of global protocol-specific options.
    Note -- this is a base class for those who don't want the
    automatic handling of errors type 302 (relocated) and 401
    (authorization needed).uPython-urllib/%scKs�di|jjd6}tj|tdd�|dkrEt�}n||_|jd�|_	|jd�|_
d|jfg|_g|_
tj|_d|_t|_dS(NuW%(class)s style of invoking requests is deprecated. Use newer urlopen functions/methodsuclassu
stackleveliukey_fileu	cert_fileu
User-Agent(u	__class__u__name__uwarningsuwarnuDeprecationWarninguNoneu
getproxiesuproxiesugetukey_fileu	cert_fileuversionu
addheadersu_URLopener__tempfilesuosuunlinku_URLopener__unlinku	tempcacheuftpcache(uselfuproxiesux509umsg((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__init__,s			uURLopener.__init__cCs|j�dS(N(uclose(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__del__FsuURLopener.__del__cCs|j�dS(N(ucleanup(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyucloseIsuURLopener.closecCss|jrVx7|jD],}y|j|�Wqtk
r>YqXqW|jdd�=n|jro|jj�ndS(N(u_URLopener__tempfilesu_URLopener__unlinkuOSErroru	tempcacheuclear(uselfufile((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyucleanupLs	
		uURLopener.cleanupcGs|jj|�dS(udAdd a header to be used by the HTTP interface only
        e.g. u.addheader('Accept', 'sound/basic')N(u
addheadersuappend(uselfuargs((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	addheaderZsuURLopener.addheadercCs�tt|��}t|dd�}|jrn||jkrn|j|\}}t|d�}t|||�St|�\}}|s�d}n||jkr�|j|}t|�\}}	t|	�\}
}|
|f}nd
}d|}||_
|jdd�}t||�sD|r1|j
|||�S|j||�Sny9|d
krft||�|�St||�||�SWn^tk
r��YnJtjk
r�}
z'td|
�jtj�d	��WYd
d
}
~
XnXd
S(u6Use URLopener().open(file) instead of open(file, 'r').usafeu%/:=&?~#+!$,;'@()*[]|urbufileuopen_u-u_usocket erroriN(uunwraputo_bytesuquoteu	tempcacheuopenu
addinfourlu	splittypeuproxiesu	splithostuNoneutypeureplaceuhasattruopen_unknown_proxyuopen_unknownugetattru	HTTPErrorusocketuerroruIOErroruwith_tracebackusysuexc_info(uselfufullurludataufilenameuheadersufpuurltypeuurluproxyu	proxyhostuhostuselectorunameumsg((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuopen`s<	

	
uURLopener.opencCs(t|�\}}tdd|��dS(u/Overridable interface to open unknown URL type.u	url erroruunknown url typeN(u	splittypeuIOError(uselfufullurludatautypeuurl((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuopen_unknown�suURLopener.open_unknowncCs,t|�\}}tdd||��dS(u/Overridable interface to open unknown URL type.u	url erroruinvalid proxy for %sN(u	splittypeuIOError(uselfuproxyufullurludatautypeuurl((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuopen_unknown_proxy�suURLopener.open_unknown_proxyc'Cs�tt|��}|jr5||jkr5|j|St|�\}}|dkr�|sf|dkr�yC|j|�}|j�}|j�tt	|�d�|fSWq�t
k
r�}	zWYdd}	~	Xq�Xn|j||�}z�|j�}
|r
t|d�}n�ddl}t|�\}
}t	|p7d�\}
}t
|pOd�\}}
t|pgd�\}}
tjj|�d}|j|�\}}|jj|�tj|d�}z�||
f}|jdk	r�||j|<nd}d
}d}d}d	|
kr%t|
d
�}n|r>||||�nx\|j|�}|sZPn|t|�7}|j|�|d7}|rA||||�qAqAWd|j�XWd|j�X|dkr�||kr�td||f|��n|S(utretrieve(url) returns (filename, headers) for a local object
        or (tempfilename, headers) for a remote object.ufileiNuwbiuiiucontent-lengthuContent-Lengthu1retrieval incomplete: got only %i out of %i bytesi i����(uunwraputo_bytesu	tempcacheu	splittypeuNoneuopen_local_fileuinfoucloseuurl2pathnameu	splithostuIOErroruopenutempfileu
splitqueryu	splitattruosupathusplitextumkstempu_URLopener__tempfilesuappendufdopenuintureadulenuwriteuContentTooShortError(uselfuurlufilenameu
reporthookudatautypeuurl1ufpuhdrsumsguheadersutfputempfileugarbageupathusuffixufduresultubsusizeureadublocknumublock((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuretrieve�sl


uURLopener.retrievecCsd}d}t|t�r]t|�\}}|rTt|�\}}t|�}n|}n�|\}}t|�\}}t|�\}	}
|
}d}|	j�dkr�d}n^t|
�\}}
|r�t|�\}}n|r�d|	||
f}nt|�r|}n|s*t	dd��n|r]t|�}t
j|j��j
d�}nd}|r�t|�}t
j|j��j
d�}nd}||�}
i}|r�d||d<n|r�d||d<n|r�||d	<nd
|d<x!|jD]\}}|||<qW|dk	rLd|d
<|
jd|||�n|
jd|d|�y|
j�}Wn$tjjk
r�td��YnXd|jko�dknr�t||jd||j�S|j||j|j|j|j|�SdS(u�Make an HTTP connection using connection_class.

        This is an internal method that should be called from
        open_http() or open_https().

        Arguments:
        - connection_factory should take a host name and return an
          HTTPConnection instance.
        - url is the url to retrieval or a host, relative-path pair.
        - data is payload for a POST request or None.
        uhttpu	%s://%s%su
http erroru
no host givenuasciiuBasic %suProxy-Authorizationu
AuthorizationuHostucloseu
Connectionu!application/x-www-form-urlencodeduContent-TypeuPOSTuGETuheadersu$http protocol error: bad status linei�i,uhttp:N(uNoneu
isinstanceustru	splithostu	splituseruunquoteu	splittypeuloweruproxy_bypassuIOErrorubase64u	b64encodeuencodeudecodeu
addheadersurequestugetresponseuhttpuclientu
BadStatusLineuURLErrorustatusu
addinfourlumsgu
http_errorufpureason(uselfuconnection_factoryuurludatauuser_passwduproxy_passwduhostuselectorurealhostuurltypeurestu
proxy_authuauthu	http_connuheadersuheaderuvalueuresponse((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu_open_generic_http�sr
			!!



	uURLopener._open_generic_httpcCs|jtjj||�S(uUse HTTP protocol.(u_open_generic_httpuhttpuclientuHTTPConnection(uselfuurludata((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	open_http-suURLopener.open_httpc
Cs�d|}t||�rwt||�}|dkrO||||||�}	n|||||||�}	|	rw|	Sn|j|||||�S(u�Handle http errors.

        Derived class can override this, or provide specific handlers
        named http_error_DDD where DDD is the 3-digit error code.u
http_error_%dN(uhasattrugetattruNoneuhttp_error_default(
uselfuurlufpuerrcodeuerrmsguheadersudataunameumethoduresult((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
http_error1s
uURLopener.http_errorcCs&|j�t||||d��dS(u>Default error handler: close the connection and raise IOError.N(ucloseu	HTTPErroruNone(uselfuurlufpuerrcodeuerrmsguheaders((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_defaultAs
uURLopener.http_error_defaultcCs"tjj|d|jd|j�S(Nukey_fileu	cert_file(uhttpuclientuHTTPSConnectionukey_fileu	cert_file(uselfuhost((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu_https_connectionGs	uURLopener._https_connectioncCs|j|j||�S(uUse HTTPS protocol.(u_open_generic_httpu_https_connection(uselfuurludata((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
open_httpsLsuURLopener.open_httpscCs�t|t�std��n|dd�dkru|dd�dkru|dd�j�dkrutd	��n
|j|�SdS(
u/Use local file or FTP depending on form of URL.uEfile error: proxy support for file protocol currently not implementedNiu//iu/iu
localhost/u-file:// scheme is supported only on localhost(u
isinstanceustruURLErroruloweru
ValueErroruopen_local_file(uselfuurl((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	open_filePs
HuURLopener.open_filecCs�ddl}ddl}t|�\}}t|�}ytj|�}Wn:tk
r�}zt|j|j	��WYdd}~XnX|j
}	|jj|j
dd�}
|j|�d}|jd|p�d|	|
f�}|s'|}
|dd�dkrd|}
ntt|d	�||
�St|�\}}|r�tj|�t�ft�kr�|}
|dd�dkr�d|}
n)|dd
�dkr�td|��ntt|d	�||
�Std
��dS(uUse local file.iNuusegmtu6Content-Type: %s
Content-Length: %d
Last-modified: %s
u
text/plainiu/ufile://urbiu./uAlocal file url may start with / or file:. Unknown url of type: %su#local file error: not on local hostT(uemail.utilsu	mimetypesu	splithostuurl2pathnameuosustatuOSErroruURLErrorustrerrorufilenameust_sizeuutilsu
formatdateust_mtimeuTrueu
guess_typeumessage_from_stringu
addinfourluopenu	splitportusocketu
gethostbynameu	localhostuthishostu
ValueError(uselfuurluemailu	mimetypesuhostufileu	localnameustatsueusizeumodifiedumtypeuheadersuurlfileuport((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuopen_local_fileYs:(	
"
uURLopener.open_local_filecCs�t|t�std��nddl}t|�\}}|sQtd��nt|�\}}t|�\}}|r�t|�\}}nd}t	|�}t	|p�d�}t	|p�d�}t
j|�}|s�ddl}|j
}nt|�}t|�\}}	t	|�}|jd�}
|
dd�|
d}
}|
rk|
drk|
dd�}
n|
r�|
dr�d|
d<n|||dj|
�f}t|j�tkrxJ|jj�D]6}
|
|kr�|j|
}|j|
=|j�q�q�Wny9||jkr:t|||||
�|j|<n|sId}nd	}xM|	D]E}t|�\}}|j�d
krV|dkrV|j�}qVqVW|j|j||�\}}|jd|�d}d}|r�|d|7}n|dk	r|dkr|d|7}ntj|�}t||d|�SWnKt �k
r�}z(td|�j!t"j#�d��WYdd}~XnXdS(uUse FTP protocol.uCftp error: proxy support for ftp protocol currently not implementediNuftp error: no host givenuu/iuDuIutypeuauAuiuduftp:uContent-Type: %s
uContent-Length: %d
uftp error %rii����i����(uauAuiuIuduD($u
isinstanceustruURLErroru	mimetypesu	splithostu	splitportu	splituserusplitpasswduNoneuunquoteusocketu
gethostbynameuftplibuFTP_PORTuintu	splitattrusplitujoinulenuftpcacheuMAXFTPCACHEukeysucloseu
ftpwrapperu
splitvalueuloweruupperuretrfileu
guess_typeuemailumessage_from_stringu
addinfourlu	ftperrorsuwith_tracebackusysuexc_info(uselfuurlu	mimetypesuhostupathuportuuserupasswduftplibuattrsudirsufileukeyukuvutypeuattruvalueufpuretrlenumtypeuheadersuexp((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuopen_ftpysp


"	
uURLopener.open_ftpc	Cs�t|t�std��ny|jdd�\}}Wn!tk
r]tdd��YnX|smd}n|jd�}|dkr�d	||d
�kr�||dd
�}|d
|�}nd}g}|jdtj	d
tj
tj����|jd|�|dkr>tj|j
d��jd�}nt|�}|jdt|��|jd�|j|�dj|�}tj|�}tj|�}t|||�S(uUse "data" URL.uEdata error: proxy support for data protocol currently not implementedu,iu
data errorubad data URLutext/plain;charset=US-ASCIIu;iu=NuuDate: %su%a, %d %b %Y %H:%M:%S GMTuContent-type: %subase64uasciiulatin-1uContent-Length: %du
(u
isinstanceustruURLErrorusplitu
ValueErroruIOErrorurfinduappendutimeustrftimeugmtimeubase64udecodebytesuencodeudecodeuunquoteulenujoinuemailumessage_from_stringuiouStringIOu
addinfourl(	uselfuurludatautypeusemiuencodingumsguheadersuf((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	open_data�s6
	"$

uURLopener.open_dataN(u__name__u
__module__u__qualname__u__doc__uNoneu_URLopener__tempfilesu__version__uversionu__init__u__del__ucloseucleanupu	addheaderuopenuopen_unknownuopen_unknown_proxyuretrieveu_open_generic_httpu	open_httpu
http_erroruhttp_error_defaultu	_have_sslu_https_connectionu
open_httpsu	open_fileuopen_local_fileuopen_ftpu	open_data(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	URLopeners.
$B\	 :cBs�|EeZdZdZdd�Zdd�Zd!dd�Zdd	�Zd!d
d�Z	d!dd
�Z
d!dd�Zd!d"dd�Z
d!d"dd�Zd!dd�Zd!dd�Zd!dd�Zd!dd�Zddd�Zdd �Zd!S(#uFancyURLopeneru?Derived class with handlers for errors we can handle (perhaps).cOs2tj|||�i|_d|_d|_dS(Nii
(u	URLopeneru__init__u
auth_cacheutriesumaxtries(uselfuargsukwargs((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__init__�s		uFancyURLopener.__init__cCst||d||�S(u3Default error handling -- don't raise an exception.uhttp:(u
addinfourl(uselfuurlufpuerrcodeuerrmsguheaders((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_default�su!FancyURLopener.http_error_defaultc	Cs�|jd7_|jrm|j|jkrmt|d�rE|j}n	|j}d|_|||dd|�S|j||||||�}d|_|S(u%Error 302 -- relocated (temporarily).iuhttp_error_500ii�u)Internal Server Error: Redirect Recursion(utriesumaxtriesuhasattruhttp_error_500uhttp_error_defaulturedirect_internal(	uselfuurlufpuerrcodeuerrmsguheadersudataumethuresult((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_302�s		
		uFancyURLopener.http_error_302c	Cs�d|kr|d}nd|kr2|d}ndS|j�t|jd||�}t|�}|jd	kr�t|||d|||��n|j|�S(
Nulocationuuriu:uhttpuhttpsuftpuu( Redirection to url '%s' is not allowed.(uhttpuhttpsuftpu(ucloseuurljoinutypeuurlparseuschemeu	HTTPErroruopen(	uselfuurlufpuerrcodeuerrmsguheadersudataunewurluurlparts((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuredirect_internal�s


	u FancyURLopener.redirect_internalcCs|j||||||�S(u*Error 301 -- also relocated (permanently).(uhttp_error_302(uselfuurlufpuerrcodeuerrmsguheadersudata((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_301suFancyURLopener.http_error_301cCs|j||||||�S(u;Error 303 -- also relocated (essentially identical to 302).(uhttp_error_302(uselfuurlufpuerrcodeuerrmsguheadersudata((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_303suFancyURLopener.http_error_303cCsE|dkr(|j||||||�S|j|||||�SdS(u1Error 307 -- relocated, but turn POST into error.N(uNoneuhttp_error_302uhttp_error_default(uselfuurlufpuerrcodeuerrmsguheadersudata((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_307suFancyURLopener.http_error_307c
Cs$d|kr+tj||||||�n|d}tjd|�}	|	sltj||||||�n|	j�\}
}|
j�dkr�tj||||||�n|s�tj||||||�nd|jd}|dkrt||�||�St||�|||�SdS(u_Error 401 -- authentication required.
        This function supports Basic authentication only.uwww-authenticateu![ 	]*([^ 	]+)[ 	]+realm="([^"]*)"ubasicuretry_u_basic_authN(	u	URLopeneruhttp_error_defaultureumatchugroupsulowerutypeuNoneugetattr(
uselfuurlufpuerrcodeuerrmsguheadersudatauretryustuffumatchuschemeurealmuname((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_401%s&

uFancyURLopener.http_error_401c
Cs$d|kr+tj||||||�n|d}tjd|�}	|	sltj||||||�n|	j�\}
}|
j�dkr�tj||||||�n|s�tj||||||�nd|jd}|dkrt||�||�St||�|||�SdS(ueError 407 -- proxy authentication required.
        This function supports Basic authentication only.uproxy-authenticateu![ 	]*([^ 	]+)[ 	]+realm="([^"]*)"ubasicuretry_proxy_u_basic_authN(	u	URLopeneruhttp_error_defaultureumatchugroupsulowerutypeuNoneugetattr(
uselfuurlufpuerrcodeuerrmsguheadersudatauretryustuffumatchuschemeurealmuname((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuhttp_error_407>s&

uFancyURLopener.http_error_407cCst|�\}}d||}|jd}t|�\}}	t|	�\}	}
|	jd�d}|	|d�}	|j|	||�\}}
|p�|
s�dSdt|dd�t|
dd�|	f}	d|	|
|jd<|dkr�|j|�S|j||�SdS(Nuhttp://uhttpu@iu%s:%s@%susafeu(u	splithostuproxiesu	splittypeufinduget_user_passwduNoneuquoteuopen(uselfuurlurealmudatauhostuselectorunewurluproxyuurltypeu	proxyhostu
proxyselectoruiuuserupasswd((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuretry_proxy_http_basic_authWs 

u*FancyURLopener.retry_proxy_http_basic_authcCst|�\}}d||}|jd}t|�\}}	t|	�\}	}
|	jd�d}|	|d�}	|j|	||�\}}
|p�|
s�dSdt|dd�t|
dd�|	f}	d|	|
|jd<|dkr�|j|�S|j||�SdS(Nuhttps://uhttpsu@iu%s:%s@%susafeu(u	splithostuproxiesu	splittypeufinduget_user_passwduNoneuquoteuopen(uselfuurlurealmudatauhostuselectorunewurluproxyuurltypeu	proxyhostu
proxyselectoruiuuserupasswd((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuretry_proxy_https_basic_authis 

u+FancyURLopener.retry_proxy_https_basic_authc
Cs�t|�\}}|jd�d}||d�}|j|||�\}}|pY|s`dSdt|dd�t|dd�|f}d||}	|dkr�|j|	�S|j|	|�SdS(Nu@iu%s:%s@%susafeuuhttp://(u	splithostufinduget_user_passwduNoneuquoteuopen(
uselfuurlurealmudatauhostuselectoruiuuserupasswdunewurl((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuretry_http_basic_auth{s
u$FancyURLopener.retry_http_basic_authc
Cs�t|�\}}|jd�d}||d�}|j|||�\}}|pY|s`dSdt|dd�t|dd�|f}d||}	|dkr�|j|	�S|j|	|�SdS(Nu@iu%s:%s@%susafeuuhttps://(u	splithostufinduget_user_passwduNoneuquoteuopen(
uselfuurlurealmudatauhostuselectoruiuuserupasswdunewurl((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuretry_https_basic_auth�s
u%FancyURLopener.retry_https_basic_authicCs�|d|j�}||jkrD|r6|j|=qD|j|Sn|j||�\}}|sh|r~||f|j|<n||fS(Nu@(uloweru
auth_cacheuprompt_user_passwd(uselfuhosturealmuclear_cacheukeyuuserupasswd((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuget_user_passwd�s
uFancyURLopener.get_user_passwdcCspddl}y@td||f�}|jd|||f�}||fSWntk
rkt�dSYnXdS(u#Override this in a GUI environment!iNuEnter username for %s at %s: u#Enter password for %s in %s at %s: (NN(ugetpassuinputuKeyboardInterruptuprintuNone(uselfuhosturealmugetpassuuserupasswd((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuprompt_user_passwd�s	
u!FancyURLopener.prompt_user_passwdNF(u__name__u
__module__u__qualname__u__doc__u__init__uhttp_error_defaultuNoneuhttp_error_302uredirect_internaluhttp_error_301uhttp_error_303uhttp_error_307uFalseuhttp_error_401uhttp_error_407uretry_proxy_http_basic_authuretry_proxy_https_basic_authuretry_http_basic_authuretry_https_basic_authuget_user_passwduprompt_user_passwd(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuFancyURLopener�s$cCs"tdkrtjd�antS(u8Return the IP address of the magic hostname 'localhost'.u	localhostN(u
_localhostuNoneusocketu
gethostbyname(((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	localhost�su	localhostcCsgtdkrcy#ttjtj��d�aWqctjk
r_ttjd�d�aYqcXntS(u,Return the IP addresses of the current host.iu	localhostN(u	_thishostuNoneutupleusocketugethostbyname_exugethostnameugaierror(((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuthishost�s#!uthishostcCs(tdkr$ddl}|jantS(u1Return the set of errors raised by the FTP class.iN(u
_ftperrorsuNoneuftplibu
all_errors(uftplib((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	ftperrors�su	ftperrorscCs"tdkrtjd�antS(u%Return an empty email Message object.uN(u
_noheadersuNoneuemailumessage_from_string(((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu	noheaders�su	noheaderscBst|EeZdZdZdddd�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�ZdS(u
ftpwrapperu;Class used by open_ftp() for cache of open FTP connections.cCsV||_||_||_||_||_||_d|_||_|j�dS(Ni(	uuserupasswduhostuportudirsutimeouturefcountu	keepaliveuinit(uselfuuserupasswduhostuportudirsutimeoutu
persistent((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu__init__�s								uftpwrapper.__init__cCs�ddl}d|_|j�|_|jj|j|j|j�|jj|j	|j
�dj|j�}|jj
|�dS(Niu/(uftplibubusyuFTPuftpuconnectuhostuportutimeoutuloginuuserupasswdujoinudirsucwd(uselfuftplibu_target((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuinit�s	uftpwrapper.initc.Cs:ddl}|j�|dkr1d}d}nd|}d}y|jj|�Wn/|jk
r�|j�|jj|�YnXd}|r0|r0y&d|}|jj|�\}}Wq0|jk
r,}zGt	|�dd�d	krt
d
|�jtj
�d��nWYdd}~Xq0Xn|s�|jjd�|r�|jj�}	zVy|jj|�Wn;|jk
r�}zt
d
|�|�WYdd}~XnXWd|jj|	�Xd|}nd
}|jj|�\}}nd|_t|jd�|j�}
|jd7_|j�|
|fS(NiuduDuTYPE AiuTYPE uRETR iu550u
ftp error: %riuLIST uLISTurb(uduD(uftplibuendtransferuftpuvoidcmdu
all_errorsuinituNoneuntransfercmdu
error_permustruURLErroruwith_tracebackusysuexc_infoupwducwdubusyuaddclosehookumakefileu
file_closeurefcountuclose(uselfufileutypeuftplibucmduisdiruconnuretrlenureasonupwduftpobj((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuretrfile�sN
	



,*
	
uftpwrapper.retrfilecCs
d|_dS(Ni(ubusy(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuendtransfer	suftpwrapper.endtransfercCs)d|_|jdkr%|j�ndS(NiF(uFalseu	keepaliveurefcountu
real_close(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuclose 	s	uftpwrapper.closecCsC|j�|jd8_|jdkr?|jr?|j�ndS(Nii(uendtransferurefcountu	keepaliveu
real_close(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
file_close%	s
uftpwrapper.file_closecCs7|j�y|jj�Wnt�k
r2YnXdS(N(uendtransferuftpucloseu	ftperrors(uself((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
real_close+	s

uftpwrapper.real_closeNT(
u__name__u
__module__u__qualname__u__doc__uNoneuTrueu__init__uinituretrfileuendtransferucloseu
file_closeu
real_close(u
__locals__((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
ftpwrapper�s	-u
ftpwrappercCs�i}x\tjj�D]K\}}|j�}|r|dd�dkr|||dd�<qqWdtjkr�|jdd�n|S(uReturn a dictionary of scheme -> proxy server URL mappings.

    Scan the environment for variables named <scheme>_proxy;
    this seems to be the standard convention.  If you need a
    different way, you can pass a proxies dictionary to the
    [Fancy]URLopener constructor.

    iNu_proxyuREQUEST_METHODuhttpi����i����(uosuenvironuitemsulowerupopuNone(uproxiesunameuvalue((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyugetproxies_environment3	s	ugetproxies_environmentcCs�tjjdd�p'tjjdd�}|dkr:dSt|�\}}dd�|jd�D�}x6|D].}|ro|j|�s�|j|�rodSqoWd	S(
u�Test if proxies should not be used for a particular host.

    Checks the environment for a variable named no_proxy, which should
    be a list of DNS suffixes separated by commas, or '*' for all hosts.
    uno_proxyuuNO_PROXYu*icSsg|]}|j��qS((ustrip(u.0uproxy((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
<listcomp>W	s	u,proxy_bypass_environment.<locals>.<listcomp>u,i(uosuenvironugetu	splitportusplituendswith(uhostuno_proxyuhostonlyuportu
no_proxy_listuname((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuproxy_bypass_environmentJ	s*
$uproxy_bypass_environmentc
Cs�ddlm}t|�\}}dd�}d|krK|drKdSnd}x.|jdf�D]}|svqdntjd|�}|dk	rk|dkr�ytj|�}||�}Wq�tj	k
r�wdYq�Xn||j
d	��}	|j
d
�}
|
dkr0d|j
d	�jd�d	}
nt|
d	d��}
d
|
}
||
?|	|
?kr~dSqd|||�rddSqdWdS(uj
    Return True iff this host shouldn't be accessed using a proxy

    This function uses the MacOSX framework SystemConfiguration
    to fetch the proxy information.

    proxy_settings come from _scproxy._get_proxy_settings or get mocked ie:
    { 'exclude_simple': bool,
      'exceptions': ['foo.bar', '*.bar.com', '127.0.0.1', '10.1', '10.0/16']
    }
    i(ufnmatchcSs�|jd�}ttt|��}t|�dkrY|ddddgdd�}n|dd>|dd>B|dd>B|d	BS(
Nu.iiiiiiii(usplitulistumapuintulen(uipAddruparts((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuip2numq	s
#u,_proxy_bypass_macosx_sysconf.<locals>.ip2numu.uexclude_simpleu
exceptionsu(\d+(?:\.\d+)*)(/\d+)?iiiNi TF(ufnmatchu	splitportuTrueuNoneugetureumatchusocketu
gethostbynameuerrorugroupucountuintuFalse(uhostuproxy_settingsufnmatchuhostonlyuportuip2numuhostIPuvalueumubaseumask((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu_proxy_bypass_macosx_sysconfa	s:
#
u_proxy_bypass_macosx_sysconfudarwin(u_get_proxy_settingsu_get_proxiescCst�}t||�S(N(u_get_proxy_settingsu_proxy_bypass_macosx_sysconf(uhostuproxy_settings((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuproxy_bypass_macosx_sysconf�	s	uproxy_bypass_macosx_sysconfcCst�S(u�Return a dictionary of scheme -> proxy server URL mappings.

        This function uses the MacOSX framework SystemConfiguration
        to fetch the proxy information.
        (u_get_proxies(((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyugetproxies_macosx_sysconf�	sugetproxies_macosx_sysconfcCs!t�rt|�St|�SdS(N(ugetproxies_environmentuproxy_bypass_environmentuproxy_bypass_macosx_sysconf(uhost((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuproxy_bypass�	s	
uproxy_bypasscCst�pt�S(N(ugetproxies_environmentugetproxies_macosx_sysconf(((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
getproxies�	scCsli}yddl}Wntk
r.|SYnXy|j|jd�}|j|d�d}|r?t|j|d�d�}d|kr�x�|jd�D]M}|jdd�\}}tjd	|�s�d
||f}n|||<q�Wq?|dd�dkr||d
<q?d||d
<d||d<d||d<n|j	�Wnt
ttfk
rgYnX|S(uxReturn a dictionary of scheme -> proxy server URL mappings.

        Win32 uses the registry to store proxies.

        iNu;Software\Microsoft\Windows\CurrentVersion\Internet SettingsuProxyEnableuProxyServeru=u;iu^([^/:]+)://u%s://%siuhttp:uhttpu	http://%su
https://%suhttpsuftp://%suftp(
uwinreguImportErroruOpenKeyuHKEY_CURRENT_USERuQueryValueExustrusplitureumatchuCloseuWindowsErroru
ValueErroru	TypeError(uproxiesuwinreguinternetSettingsuproxyEnableuproxyServerupuprotocoluaddress((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyugetproxies_registry�	s8
			

ugetproxies_registrycCst�pt�S(u�Return a dictionary of scheme -> proxy server URL mappings.

        Returns settings gathered from the environment, if specified,
        or the registry.

        (ugetproxies_environmentugetproxies_registry(((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu
getproxies�	sc'Cs�yddl}Wntk
r(dSYnXyK|j|jd�}|j|d�d}t|j|d�d�}Wntk
r�dSYnX|s�|r�dSt|�\}}|g}y/tj	|�}||kr�|j
|�nWntjk
rYnXy/tj|�}||kr/|j
|�nWntjk
rGYnX|j
d�}x�|D]�}	|	dkr�d|kr�dSn|	jdd	�}	|	jd
d�}	|	jdd�}	x*|D]"}
tj|	|
tj�r�dSq�Wq^WdS(
Niu;Software\Microsoft\Windows\CurrentVersion\Internet SettingsuProxyEnableu
ProxyOverrideu;u<local>u.iu\.u*u.*u?(uwinreguImportErroruOpenKeyuHKEY_CURRENT_USERuQueryValueExustruWindowsErroru	splitportusocketu
gethostbynameuappenduerrorugetfqdnusplitureplaceureumatchuI(uhostuwinreguinternetSettingsuproxyEnableu
proxyOverrideurawHostuportuaddrufqdnutestuval((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuproxy_bypass_registry�	sR
			

		

uproxy_bypass_registrycCs!t�rt|�St|�SdS(u�Return a dictionary of scheme -> proxy server URL mappings.

        Returns settings gathered from the environment, if specified,
        or the registry.

        N(ugetproxies_environmentuproxy_bypass_environmentuproxy_bypass_registry(uhost((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyuproxy_bypass!
s	
(~u__doc__ubase64ubisectuemailuhashlibuhttp.clientuhttpuiouosu	posixpathureusocketusysutimeucollectionsutempfileu
contextlibuwarningsuurllib.erroruURLErroru	HTTPErroruContentTooShortErroruurllib.parseuurlparseuurlsplituurljoinuunwrapuquoteuunquoteu	splittypeu	splithostu	splitportu	splituserusplitpasswdu	splitattru
splitqueryu
splitvalueusplittaguto_bytesu
urlunparseuurllib.responseu
addinfourluaddclosehookussluImportErroruFalseu	_have_ssluTrueu__all__uversionu__version__uNoneu_openeru_GLOBAL_DEFAULT_TIMEOUTuurlopenuinstall_openeru_url_tempfilesuurlretrieveu
urlcleanupucompileuASCIIu_cut_port_reurequest_hostuRequestuOpenerDirectorubuild_openeruBaseHandleruHTTPErrorProcessoruHTTPDefaultErrorHandleruHTTPRedirectHandleru_parse_proxyuProxyHandleruHTTPPasswordMgruHTTPPasswordMgrWithDefaultRealmuAbstractBasicAuthHandleruHTTPBasicAuthHandleruProxyBasicAuthHandleruurandomu_randombytesuAbstractDigestAuthHandleruHTTPDigestAuthHandleruProxyDigestAuthHandleruAbstractHTTPHandleruHTTPHandleruhasattruclientuHTTPSHandleruappenduHTTPCookieProcessoruUnknownHandleruparse_keqv_listuparse_http_listuFileHandleru_safe_gethostbynameu
FTPHandleruCacheFTPHandleruMAXFTPCACHEunameu
nturl2pathuurl2pathnameupathname2urluftpcacheu	URLopeneruFancyURLopeneru
_localhostu	localhostu	_thishostuthishostu
_ftperrorsu	ftperrorsu
_noheadersu	noheadersu
ftpwrapperugetproxies_environmentuproxy_bypass_environmentu_proxy_bypass_macosx_sysconfuplatformu_scproxyu_get_proxy_settingsu_get_proxiesuproxy_bypass_macosx_sysconfugetproxies_macosx_sysconfuproxy_bypassu
getproxiesugetproxies_registryuproxy_bypass_registry(((u3/opt/alt/python33/lib64/python3.3/urllib/request.pyu<module>Ds�p
					$?
y�&hH*@
E	�n

+4:8���

[<
-	2