TdZddlmZmZmZmZddlmZmZm Z m Z m Z m Z m Z mZddlmZmZmZddlZddlZddlZddlZddlmZddlmZdd lmZmZmZdd l m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1dd l2m3Z3m4Z4ddl5Z5ddl6Z6ddl7Z7ddl8Z8ddl9Z9ddl:Z:ddl;Z;ddlZ>dd lmZerdd l?m@Z@ndd lAm@Z@ ddlBZBddlBmCZCdZDn #eE$rdZDYnwxYwgdZFe:jGddZHdaIde9jJfdZKdZLgZMdidZNdZOere8jPde8jQZRne8jPdZRdZSGddeTZUGddeTZVdZWGddeTZXGd d!eXZYGd"d#eXZZGd$d%eXZ[d&Z\Gd'd(eXZ]Gd)d*eTZ^Gd+d,e^Z_Gd-d.eTZ`Gd/d0e`eXZaGd1d2e`eXZbe6jcZdGd3d4eTZeGd5d6eXeeZfGd7d8eXeeZgGd9d:eXZhGd;dd?ehZkeFld?Gd@dAeXZmGdBdCeXZndDZodEZpGdFdGeXZqdHZrGdIdJeXZsGdKdLesZtdMZue6jvdNkr ddOlwmxZxmyZyndPZxdQZyiZzGdRdSeTZ{GdTdUe{Z|da}dVZ~dadWZdadXZdadYZGdZd[eTZd\Zd]Zd^Ze:jd_krdd`lmZmZdaZdbZdcZddZdSe6jvdNkrdeZdfZdgZdhZdSeZeZdS)ja Ported using Python-Future from the Python 3.3 standard library. 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/') )absolute_importdivisionprint_functionunicode_literals)bytesdictfilterinputintmapopenstr)PY2PY3raise_with_tracebackN)email)client)URLError HTTPErrorContentTooShortError)urlparseurlspliturljoinunwrapquoteunquote splittype splithost splitport splituser splitpasswd splitattr splitquery splitvaluesplittagto_bytes urlunparse) addinfourl addclosehook)r)Iterable) SSLContextTF)RequestOpenerDirector BaseHandlerHTTPDefaultErrorHandlerHTTPRedirectHandlerHTTPCookieProcessor ProxyHandlerHTTPPasswordMgrHTTPPasswordMgrWithDefaultRealmAbstractBasicAuthHandlerHTTPBasicAuthHandlerProxyBasicAuthHandlerAbstractDigestAuthHandlerHTTPDigestAuthHandlerProxyDigestAuthHandler HTTPHandler FileHandler FTPHandlerCacheFTPHandlerUnknownHandlerHTTPErrorProcessorurlopeninstall_opener build_opener pathname2url url2pathname getproxies urlretrieve urlcleanup URLopenerFancyURLopenerc Dd|vr |d}|d=nd}d|vr |d}|d=nd}d|vr |d}|d=nd}|s|s|rtstdtjtj}|xjtjzc_tj|_|s|r| ||n| t|d}t|} nttxa } nt} | |||S)N cadefaultFcapathcafilezSSL support not availableTcontextcheck_hostname) _have_ssl ValueErrorsslr,PROTOCOL_SSLv23options OP_NO_SSLv2 CERT_REQUIRED verify_modeload_verify_locationsset_default_verify_paths HTTPSHandlerrD_openerr ) urldatatimeout _3to2kwargsrNrOrPrR https_handleropeners q/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/future/backports/urllib/request.pyrBrBsUk!!{;/G9[YdMeMe);X)>KPXDYDY&;X)>KPXDYDY& 9 :899 9.!4553?*!/  /V /  ) )&& 9 9 9 9  , , . . .$WTJJJ m,, '>>)&& ;;sD' * **c |adSN)r_)res rfrCrCs GGGrgcLt|\}}tjt||5}|}|dkr/|s-t j||fcdddS|rt|d}n6tj d}|j }t ||5||f} d} d} d} d} d |vrt|d } |r || | |  || }|sn<| t!|z } ||| d z } |r || | | T dddn #1swxYwYdddn #1swxYwY| dkr| | krt%d | | fz| | S)aW 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. fileNwbF)delete rcontent-lengthContent-LengthTr1retrieval incomplete: got only %i out of %i bytes)r contextlibclosingrBinfoospathnormpathr tempfileNamedTemporaryFilename_url_tempfilesappendr readlenwriter)r`filename reporthookraurl_typerwfpheaderstfpresultbssizer~blocknumblocks rfrHrHs s^^NHd  GC.. / /$32'')) v  h 7##D))72 $3$3$3$3$3$3$3$3  ,x&&CC-U;;;CxH  ! !( + + +  3 3w&FBDDH7**7#3455 / 8R... 3 E " %   A 3JxT222 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3!$3$3$3$3$3$3$3$3$3$3$3$3$3$3$3L qyyTD[[" ?Tl "$$ $ Ms==E8?A E8 B E! E8!E% %E8(E% )E88E<?E<ctD]'} tj|#t$rY$wxYwtdd=trdadSdSri)r|rvunlinkEnvironmentErrorr_) temp_files rfrIrIsr#   Ii     D  qqqs   --z:\d+$c|j}t|d}|dkr|dd}td|d}|S)zReturn request-host, as defined by RFC 2965. Variation from RFC: returned value is lowercased, for convenient comparison. rHost)full_urlr get_header _cut_port_resublower)requestr`hosts rf request_hostrsa  C C== D rzz!!&"--   Ba ( (D ::<<rgceZdZdidddfdZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdZdZddZdZdS)r-NFc|t||_t|j\|_|_||_i|_d|_|D]\}}|||i|_ |t|}||_ ||_ ||_ |dSri)rrr&fragmentrar _tunnel_hostitems add_headerunredirected_hdrsrorigin_req_host unverifiablemethod_parse) selfr`rarrrrkeyvalues rf__init__zRequest.__init__ss  '/ '>'>$ t}   !--// ( (JC OOC ' ' ' '!#  "*400O.(  rgct|j\|_}|jtd|jzt |\|_|_|jrt|j|_dSdS)Nzunknown url type: %r)rrtyperUrrselectorr)rrests rfrzRequest._parse.sr#DM22 4 9 3dmCDD D#,T??  4= 9 + **DIII + +rgc4|j|jS|jdSdS)z3Return a string indicating the HTTP request method.NPOSTGET)rrars rf get_methodzRequest.get_method6s$ ; ";  Y "65rgc@|jr|jd|jS|jS)N#)rrrs rf get_full_urlzRequest.get_full_url?s) = !"mmmT]]; ;= rgcPd}tj|td||_dS)Nz&Request.add_data method is deprecated.r stacklevelwarningswarnDeprecationWarningra)rramsgs rfadd_datazRequest.add_dataGs*6 c-!<<<< rgcPd}tj|td|jduS)Nz&Request.has_data method is deprecated.rrrrrs rfhas_datazRequest.has_dataLs,6 c-!<<<<y$$rgcLd}tj|td|jS)Nz&Request.get_data method is deprecated.rrrrs rfget_datazRequest.get_dataQ'6 c-!<<<<yrgcLd}tj|td|jS)Nz&Request.get_type method is deprecated.rr)rrrrrs rfget_typezRequest.get_typeVrrgcLd}tj|td|jS)Nz&Request.get_host method is deprecated.rr)rrrrrs rfget_hostzRequest.get_host[rrgcLd}tj|td|jS)Nz*Request.get_selector method is deprecated.rr)rrrrrs rf get_selectorzRequest.get_selector`s': c-!<<<<}rgcLd}tj|td|jS)Nz-Request.is_unverifiable method is deprecated.rr)rrrrrs rfis_unverifiablezRequest.is_unverifiablees(= c-!<<<<  rgcLd}tj|td|jS)Nz1Request.get_origin_req_host method is deprecated.rr)rrrrrs rfget_origin_req_hostzRequest.get_origin_req_hostjs(A c-!<<<<##rgcx|jdkr|js |j|_n||_|j|_||_dS)Nhttps)rrrrr)rrrs rf set_proxyzRequest.set_proxyqs? 9  (9  $ D  DI MDM rgc"|j|jkSri)rrrs rf has_proxyzRequest.has_proxyys} --rgc>||j|<dSri)r capitalizerrvals rfrzRequest.add_header|s), S^^%%&&&rgc>||j|<dSri)rrrs rfadd_unredirected_headerzRequest.add_unredirected_headers36s~~//000rgc&||jvp||jvSri)rr)r header_names rf has_headerzRequest.has_headers!t|+6t55 7rgcj|j||j||Sri)rgetr)rrdefaults rfrzRequest.get_headers5|   " & &{G < <>> >rgc|j}||jt |Sri)rcopyupdaterlistr)rhdrss rf header_itemszRequest.header_itemss@%**,, DL!!!DJJLL!!!rgri)__name__ __module__ __qualname__rrrrrrrrrrrrrrrrrrrrgrfr-r-sH!%r!%E&+++!!! %%%     !!! $$$...---777777>>>> """""rgr-cJeZdZdZdZdZdZdejfdZ d dZ dZ dS) r.ctdtz}d|fg|_g|_i|_i|_i|_i|_dS)NPython-urllib/%sz User-agent) __version__ addheadershandlers handle_open handle_errorprocess_responseprocess_request)rclient_versions rfrzOpenerDirector.__init__sH+k9(.9:  "!rgcLt|dstdt|zd}t|D].}|dvr|d}|d|}||dzd}|dro|d|zdz}||dzd} t |}n#t$rYnwxYw|j |i} | |j|<n1|dkr |}|j } n!|d kr |}|j } n|d kr |}|j } n| |g} | rtj| |n| |d }0|r1tj|j|||dSdS) N add_parentz%expected BaseHandler instance, got %rF)redirect_requestdo_open proxy_open_rerrorr responserT)hasattr TypeErrorrdirfind startswithr rUrrrrr setdefaultbisectinsortr}rr) rhandleraddedmethiprotocol conditionjkindlookuprs rf add_handlerzOpenerDirector.add_handlersw -- +C MM*++ +LL# # DDDD #ABQBxHQqSTT I##G,, NN3''!+a/AaCDDzt99DD!D*..x<<.4!(++f$$)j((.i''-((r22H ) h0000(((EE  % M$- 1 1 1   t $ $ $ $ $ % %s3C CCcdSrirrs rfclosezOpenerDirector.close rgcr||d}|D]}t||}||}||cSdS)Nr)rgetattr) rchainr  meth_nameargsrrfuncrs rf _call_chainzOpenerDirector._call_chains^99T2&&  G7I..DT4[F! "  rgNct|tr|}t|trt ||}n |}|||_||_|j}|dz}|j |gD]}t||}||}| ||} |dz}|j |gD]}t||}||| } | S)z Accept a URL or a Request object Python-Future: if the URL is passed as a byte-string, decode it first. N_request _response) isinstancerdecoderr-rarbrrrr_openr) rfullurlrarbreqr r processorrrs rfr zOpenerDirector.opens gu % % 'nn&&G gs # # '4((CCC 8Z' -11(B??  I9i00D$s))CC::c4(([( .228R@@ + +I9i00DtC**HHrgc||jdd|}|r|S|j}||j||dz|}|r|S||jdd|S)Nr default_openrunknown unknown_open)rrr)rr rarr s rfrzOpenerDirector._opens!!$"2I"0#77  M8!!$"2Hh")?*+.00  M 0) .55 5rgc|dvr|jd}|d}d|z}d}|}n|j}|dz}d}|||f|z}|j|}|r|S|r|dd f|z}|j|SdS) Nhttprr(z http_error_%sr_errorrrhttp_error_default)rr)rprotorrrhttp_err orig_argsrs rfrzOpenerDirector.error s % % %$V,DGE'%/IHII$D(IHeY'$.!!4(  M  +)%9:YFD#4#T* * + +rgri) rrrrrrrsocket_GLOBAL_DEFAULT_TIMEOUTr rrrrgrfr.r.s " " "-%-%-%^      "&v/M    D 5 5 5 5+++++rgr.cd}t}ttttt t ttg}ttdr| tt}|D]]}|D]X}||r&t||r||3t!||r||Y^|D]}|||D]}|| |D],}||r |}||-|S)a*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. cLt|tpt|dS)N __bases__)rrr)objs rfisclasszbuild_opener..isclass/s!#t$$A[(A(AArgHTTPSConnection)r.r3r@r<r0r1r>r=rAr http_clientr}r^set issubclassaddrremover)rr5redefault_classesskipklasscheckhs rfrDrD&sBBB  F#^[.0C!;0BDO{-..-|,,, 55D     Ewu~~ eU++$HHUOOOE5))   &&u%%%% $$5577####  71:: A1 Mrgc$eZdZdZdZdZdZdS)r/c||_dSri)parent)rrDs rfrzBaseHandler.add_parentOs  rgcdSrirrs rfrzBaseHandler.closeRrrgcFt|dsdS|j|jkS)N handler_orderT)rrG)rothers rf__lt__zBaseHandler.__lt__Vs,uo.. 4!E$777rgN)rrrrGrrrIrrgrfr/r/LsFM   88888rgr/c eZdZdZdZdZeZdS)rAzProcess HTTP error responses.ic|j|j|}}}d|cxkrdks!n|jd|||||}|S)N,r()coderrurDr)rrrrNrrs rf http_responsez HTTPErrorProcessor.http_responsecsg"-x}}4ct!!!!c!!!!{((4d<z7HTTPRedirectHandler.redirect_request..sI??TQWWYYo==a&====??rgT)rrr) rrrreplacerrrr-r) rr rrNrrnewurlm newheadersras @rfrz$HTTPRedirectHandler.redirect_request|s NN  ---!2F2F&&1;;CL$WbAA AU++<????S[->->-@-@????? v)'*':$(*** *rgc,d|vr |d}nd|vr |d}ndSt|}|jdvrt|||d|d|||jst |}d|d<t |}t |j|}|||||||}|dSt|drf|j x} |_ | |d |j kst| |jkr t|j||j|z||nix} x|_ |_ | |d d z| |<|||j||j S) Nlocationurir(rftprz - Redirection to url 'z' is not allowed/r) redirect_dictrrrb)rschemerrwrr(rrrrrmr max_repeatsrmax_redirectionsinf_msgr~rrDr rb) rr rrNrrrdurlpartsnewvisiteds rfhttp_error_302z"HTTPRedirectHandler.http_error_302s  Z(FF g  U^FF FF## ?"> > >ADfffM  } H~~HHQKH%%v.. ##CT3HH ; F 3 ( ( A*-*; ;Gc' FA&&$*:::G  555 d $ s 2GRAAA6?A @G @c'#*;!++fa0014    {S[999rgzoThe HTTP server returned a redirect error that would lead to an infinite loop. The last 30x error message was: N) rrrrprqrrvhttp_error_301http_error_303http_error_307rrrrgrfr1r1tsVK***D5:5:5:n8FENE^n2GGGrgr1cZt|\}}|dsd}|}nO|dstd|z|dd}|dkrd}|d|}t |\}}|t |\}}ndx}}||||fS)a3Return (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') rlN//zproxy URL with no authority: %rr)ro)rrrUrr!r") proxyror_scheme authorityenduserinfohostportuserpasswords rf _parse_proxyrsd!''FH   s # # $ ""4(( H>FGG GmmC## "99CQsUO "9--Hh$X..hhx 48 ++rgc eZdZdZddZdZdS)r3dNc|t}t|ds Jd||_|D]#\}}t |d|z|||jfd$dS)Nkeysproxies must be a mappingz%s_openc||||Srir)rr|rrs rfz'ProxyHandler.__init__../sQt,,rg)rGrproxiesrsetattrr)rrrr`s rfrzProxyHandler.__init__(s ? llGw''DD)DDD'   . .ID# D)d*$'d--- . . . . . .rgc|j}t|\}}}}||}|jrt|jrdS|ru|rst |dt |} t j| d} | dd| zt |}| ||||ks|dkrdS|j ||j S)N:asciiProxy-authorizationBasic rrn)rrr proxy_bypassrbase64 b64encodeencoderrrrDr rb) rr r|r orig_type proxy_typerrr user_passcredss rfrzProxyHandler.proxy_open2sH /;E/B/B, D(H  "J 8  SX.. 4  DH D#*4====#*8#4#4#46I$Y%5%5%7%788??HHE NN0(U2B C C C8$$ h +++  " "i7&:&:4;##C#== =rgri)rrrrGrrrrgrfr3r3$s<M....>>>>>rgr3c.eZdZdZdZdZddZdZdS) r4ci|_dSri)passwdrs rfrzHTTPPasswordMgr.__init__Ps  rgct|tr|g}|jvr ij|<dD]0tfd|D}||fj||<1dS)NTFc<g|]}|Sr) reduce_uri)r^u default_portrs rf z0HTTPPasswordMgr.add_password..[s'???aL11???rg)rrrtuple)rrealmrirr reduced_urirs` @rf add_passwordzHTTPPasswordMgr.add_passwordSs c3   %C  # #!#DK ' = =L?????3???AAK/3VnDK { + + = =rgc|j|i}dD]U}|||}|D](\}}|D] }|||r|cccS!)VdS)NrNN)rrrr is_suburi) rrauthuridomainsrreduced_authuriurisauthinforis rffind_user_passwordz"HTTPPasswordMgr.find_user_password^s+//%,,' ( (L"oog|DDO")--// ( (h((C~~c?;;('(( (zrgTct|}|dr|d}|d}|dpd}nd}|}d}t|\}}|r%|#|!ddd|} | d || fz}||fS) z@Accept authority or URI and extract only the authority and path.rrr)rlNPir'z%s:%d)rr r) rrirpartsror~rwrportdports rfrzHTTPPasswordMgr.reduce_urihs  8 1XFaI8?sDDFIDy)) d  4DLV-?!s6{{  #tUm3 $rgc||krdS|d|dkrdStj|d|df}t|t|dkrdSdS)zcCheck if test is below base in a URI tree Both args must be URIs in reduced form. TrFr) posixpath commonprefixr)rbasetestcommons rfrzHTTPPasswordMgr.is_suburisl 4<<4 7d1g  5'a$q'(:;; v;;#d1g,, & &4urgN)T)rrrrrrrrrrgrfr4r4Nsd = = =.     rgr4ceZdZdZdS)r5ct|||\}}|||fSt|d|Sri)r4r)rrrrrs rfrz2HTTPPasswordMgrWithDefaultRealm.find_user_passwordsL(;;D% !11$gFFFrgN)rrrrrrgrfr5r5s(GGGGGrgr5cTeZdZejdejZddZdZdZ dZ dS)r6z1(?:.*,)*[ ]*([^ ]+)[ ]+realm=(["']?)([^"']*)\2Ncd|t}||_|jj|_d|_dSNr)r4rrretried)r password_mgrs rfrz!AbstractBasicAuthHandler.__init__s2  *,,L"  K4 rgcd|_dSrrrs rfreset_retry_countz*AbstractBasicAuthHandler.reset_retry_count  rgc||d}|jdkr%t|dd|d|xjdz c_|r|d}|dkrt d|ztj |}|r~| \}}}|dvrtj d td |dkr1||||} | r| jdkrd|_| SdSdSdS) Nzbasic auth failedrrbasiczDAbstractBasicAuthHandler does not support the following scheme: '%s')"'zBasic Auth Realm was unquotedr))rrrrsplitrrUr6rxsearchgroupsrr UserWarningretry_http_basic_authrN) rauthreqrr rromorrrs rfhttp_error_auth_reqedz.AbstractBasicAuthHandler.http_error_auth_reqedsn++gt,, >b >!TT22&Cf.szz||<<CCGLLLD{t/66$>>t  ' '(8$ ? ? ?;##C#== =4rgri) rrrrecompileIrrrrrrrgrfr6r6su 124$ 8 8B(((@     rgr6ceZdZdZdZdS)r7 Authorizationcl|j}|d|||}||S)Nwww-authenticate)rrr)rr rrNrrr`rs rfhttp_error_401z#HTTPBasicAuthHandler.http_error_401s?l--.@*-sG==    rgN)rrrrrrrgrfr7r7s(!Krgr7ceZdZdZdZdS)r8rcl|j}|d|||}||SNproxy-authenticaterrr)rr rrNrrr~rs rfhttp_error_407z$ProxyBasicAuthHandler.http_error_407sC H --.B*3S'CC    rgN)rrrrrrrgrfr8r8s('K     rgr8c@eZdZd dZdZdZdZdZdZdZ d Z dS) r9Nc|t}||_|jj|_d|_d|_d|_dSr)r4rrr nonce_count last_nonce)rrs rfrz"AbstractDigestAuthHandler.__init__s@ >$&&F  K4 rgcd|_dSrrrs rfrz+AbstractDigestAuthHandler.reset_retry_countrrgc||d}|jdkrt|jdd|d|xjdz c_|rr|d}|dkr|||S|dkrtd|zdSdS) Nrrzdigest auth failedrrdigestrzEAbstractDigestAuthHandler does not support the following scheme: '%s')rrrrrrretry_http_digest_authrU)rrrr rrros rfrz/AbstractDigestAuthHandler.http_error_auth_reqeds++k400 > > #'$$uuuclll")''+  - Of, ,D  - Of, ,D "Y..  I DH HD sAA A"!A"c<|dkrdn |dkrdfd}|fS)Nr cttj|dSNr)rmd5rrxs rfrz?AbstractDigestAuthHandler.get_algorithm_impls..~s('+ahhw&7&788BBDDrgSHActtj|dSr)rrrrrs rfrz?AbstractDigestAuthHandler.get_algorithm_impls..s(',qxx'8'899CCEErgc$|d|S)Nrr)rdrs rfrz?AbstractDigestAuthHandler.get_algorithm_impls..s!!qqq!!,--rgr)rr rrs @rfrz-AbstractDigestAuthHandler.get_algorithm_impls{sB   DDAA %  EEA - - - -"u rgcdSrir)rrars rfrz+AbstractDigestAuthHandler.get_entity_digeststrgri) rrrrrrrr rrrrrgrfr9r9sIII(      :::xrgr9c eZdZdZdZdZdZdS)r:zAn authentication protocol defined by RFC 2069 Digest authentication improves on basic authentication because it does not transmit passwords in the clear. rct|jd}|d|||}||S)Nrr)rrrrrr rrNrrrretrys rfrz$HTTPDigestAuthHandler.http_error_401sL %%a(**+=+/g??     rgN)rrrrPrrGrrrgrfr:r:s9 "KMrgr:ceZdZdZdZdZdS)r;Proxy-Authorizationr'cl|j}|d|||}||Srrr)s rfrz%ProxyDigestAuthHandler.http_error_407s?x**+?+/g??     rgN)rrrrrGrrrgrfr;r;s-'KMrgr;c(eZdZddZdZdZdZdS)AbstractHTTPHandlerrc||_dSri _debuglevel)r debuglevels rfrzAbstractHTTPHandler.__init__s%rgc||_dSrir1)rlevels rfset_http_debuglevelz'AbstractHTTPHandler.set_http_debuglevels rgc|j}|std|j0|j}t|trd}t ||ds|dd|dsd} tr2t|tj rt||j z}n&t|}t||j z}|dd|znG#t $r:t|tr"tdt|d|YnwxYw|}|r)t#|j\}} t'| \}} |d s|d ||jjD]D\} } | } || s|| | E|S) N no host givenzLPOST data should be bytes or an iterable of bytes. It cannot be of type str.z Content-type!application/x-www-form-urlencodedzContent-lengthz%dz=Content-Length should be specified for iterable data of type r\r)rrrarrrrrrarrayritemsize memoryviewr+rUrrrrrrDrr) rrrrarrmvsel_hostroselsel_pathr{rs rf do_request_zAbstractHTTPHandler.do_request_sL| ,?++ + < #  + +FH = = =;1 = =KD%??$$D%%d++ =//e<<<sAD AE Ec | |j}|std||fd|ji|}t|j t fd|jDd d<td D |jr2i}d}| vr |||< |=| |j| | | |j |j |}|jr |jd |_n:#t"j$r(} |t| d } ~ wwxYw||_|j|_|S) zReturn an HTTPResponse object for the request, using http_class. http_class must implement the HTTPConnection API from http.client. r8rbc3.K|]\}}|v ||fVdSrir)r^r_r`rs rfrbz.AbstractHTTPHandler.do_open..sA11tq! //F////11rgr Connectionc3HK|]\}}||fVdSri)title)r^r{rs rfrbz.AbstractHTTPHandler.do_open..s3LLytS c*LLLLLLrgr,rN)rrrbrrrrrr set_tunnelrrrra getresponsesockrr/rrr`reasonr) r http_classr http_conn_argsrr@tunnel_headersproxy_auth_hdrrerrrs @rfrzAbstractHTTPHandler.do_opens x ,?++ + Jt C CS[ CN C Cs,--t1111s{/@/@/B/B11111 2 2 2!( LLGMMOOLLLLL   CN2N((181H~.N+ LL)>L B B B  IIcnn&& ch H H H  Av  |   GGIII3--    "" s-4EF,#FFNr)rrrrr6rArrrgrfr/r/sV&&&&!!!111f<<<<<rgr/c"eZdZdZejZdS)r<cB|tj|Sri)rr7HTTPConnectionrr s rf http_openzHTTPHandler.http_open$s||K6<< 2 2 2 2  L L L,7 rgr^c*eZdZddZdZdZeZeZdS)r2NcXddlmcmcm}||}||_dSr)future.backports.http.cookiejar backportsr( cookiejar CookieJar)rrchttp_cookiejars rfrzHTTPCookieProcessor.__init__;sH@@@@@@@@@@@@  &0022I"rgc:|j||Sri)rcadd_cookie_header)rrs rfrWz HTTPCookieProcessor.http_requestAs ((111rgc<|j|||Sri)rcextract_cookies)rrrs rfrOz!HTTPCookieProcessor.http_responseEs &&x999rgri)rrrrrWrOr^rQrrgrfr2r2:sL#### !M"NNNrgr2ceZdZdZdS)r@c4|j}td|z)Nzunknown url type: %s)rr)rr rs rfr%zUnknownHandler.unknown_openMsx-4555rgN)rrrr%rrgrfr@r@Ls#66666rgr@ci}|D]B}|dd\}}|ddkr|ddkr |dd}|||<C|S)z>Parse list of key=value strings where keys are not duplicated.=rrrro)r)lparsedeltr_r`s rfrrQsc Fyya  1 Q43;;1R5C<<!B$Aq Mrgcg}d}dx}}|D]P}|r||z }d} |r|dkrd}|dkrd}||z }%|dkr||d}C|dkrd}||z }Q|r||d|DS)apParse 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. rF\Tr,c6g|]}|Srstrip)r^parts rfrz#parse_http_list..s ) ) )TDJJLL ) ) )rg)r})rresrwescapercurs rfrr[s C DFU   CKDF   d{{ CKD  #:: JJt   D  #::E    4 ) )S ) ) ))rgc$eZdZdZdZdZdZdS)r=c|j}|dddkrL|dddkr>|jr7|jdkr,|j|urtddS||S)Nr)r{rLrl localhost-file:// scheme is supported only on localhost)rr get_namesropen_local_file)rr r`s rf file_openzFileHandler.file_opensl rr7d??s1Q3x3CHK''8t~~////NOOO0/'',, ,rgNcXtj ttjddtjtjdzt_n4#tj$r"tjdft_YnwxYwtjS)Nr}r))r=namesrr/gethostbyname_ex gethostnamegaierror gethostbynamers rfrzFileHandler.get_namess   $ I$)+K88;+F,>,@,@AA!DE%F%F !!? I I I%+%9+%F%F$H !!! I  sAA,,.BBcpddlmcmcm}ddl}|j}|j}t|} tj |}|j }| |j d} | |d} tjd| pd|| fz} |rt|\}} |r%| sRt!||vr/|r d|z|z} nd|z} t%t'|d| | Sn!#t($r}t+|d}~wwxYwt+d) NrTusegmtz6Content-type: %s Content-length: %d Last-modified: %s text/plainfile://rbzfile not on local host)future.backports.email.utilsrbrutils mimetypesrrrFrvstatst_size formatdatest_mtime guess_typemessage_from_stringr _safe_gethostbynamerr)r OSErrorr)rr  email_utilsrrr localfilestatsrmodifiedmtyperrorigurlexps rfrzFileHandler.open_local_files::::::::::::x< **  GI&&E=D"--enT-JJH((2215E/K&,h7899G -&t__ d K K1$774>>;K;KKK3'$.9GG'(2G!$y$"7"7'JJJ   3--  /000sCD D&D!!D&)rrrrrrrrrgrfr=r=sH--- E!!!11111rgr=cX tj|S#tj$rYdSwxYwri)r/rrrs rfrrs<#D))) ?tts ))ceZdZdZdZdS)r>cddl}ddl}|j}|stdt |\}}||j}nt |}t|\}}|rt|\}}nd}t|}|pd}|pd} tj |}n&#tj $r}t|d}~wwxYwt|j\} } | d} t!t#t| } | dd| d} } | r| ds | dd} |||||| |j} | rdpd}| D]D}t)|\}}|d kr|d vr|}E| | |\}}d}||jd}|r|d |zz }||dkr|d |zz }t5j|}t9|||jS#|j$r,}td |z}t=|Yd}~dSd}~wwxYw)Nrftp error: no host givenrrlrorrDraArrr$rzContent-type: %s zContent-length: %d ftp error: %r)ftplibrrrr FTP_PORTr r!r"rr/rrr#rrrr connect_ftprbr%rupperretrfilerrrrr) all_errorsr)rr rrrrrrrrwattrsdirsrkfwrattrrrretrlenrrrexcs rfftp_openzFTPHandler.ftp_opens x 7566 6t__ d <?DDt99Dt__ d  &t,,LD&&Ft}}zr2 '--DD|   3--   -- ezz#C&&''#2#YRd  Q 8D &!!$dD#+NNBr>s33&3&3&j,,,,,rgr>c2eZdZdZdZdZdZdZdZdS)r?cLi|_i|_d|_d|_d|_dS)Nr<r)cacherbsoonestdelay max_connsrs rfrzCacheFTPHandler.__init__s)    rgc||_dSri)r)rts rf setTimeoutzCacheFTPHandler.setTimeouts  rgc||_dSri)r)rres rf setMaxConnszCacheFTPHandler.setMaxConnss rgcP|||d||f}||jvr$tj|jz|j|<n?t |||||||j|<tj|jz|j|<||j|S)Nrl)joinrrrrbr check_cache)rrrrrrrbrs rfrzCacheFTPHandler.connect_ftp sD$7 $*   $ dj 8DL  (vtT)-w88DJsO $ dj 8DL  z#rgctj}|j|krat|jD]:\}}||kr/|j||j|=|j|=;tt|j|_t|j|j krt|jD]"\}}||jkr|j|=|j|=n#tt|j|_dSdSri) rrrrbrrrminvaluesrr)rrr_r`s rfrzCacheFTPHandler.check_caches8 IKK <1  T\//1122 ( (1q55JqM''))) 1  Q4 3 3 5 56677  tz??dn , ,T\//1122  1 $$ 1  QE%tDL$7$7$9$9::;;DLLL - ,rgc|jD]}||j|jdSri)rrrclearrb)rconns rf clear_cachezCacheFTPHandler.clear_cache)s\J%%''  D JJLLLL  rgN) rrrrrrrrrrrgrfr?r?sn   <<<(rgr?rVnt)rFrEc t|S)zOS-specific conversion from a relative URL of the 'file' scheme to a file system path; not recommended for general use.)rpathnames rfrFrF8sx   rgc t|S)zOS-specific conversion from a file system path to a relative URL of the 'file' scheme; not recommended for general use.)rrs rfrErE=sXrgceZdZdZdZdezZddZdZdZ dZ dZ dd Z dd Z dd Zdd Zd ZddZddZdZerdZddZdZdZdZddZdS)rJa,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).Nrc dd|jjiz}tj|td|t }t |ds Jd||_|d|_ |d|_ d |j fg|_ g|_ tj|_d|_t$|_dS) NzW%(class)s style of invoking requests is deprecated. Use newer urlopen functions/methodsclassrLrrrkey_file cert_filez User-Agent) __class__rrrrrGrrrrrversionr_URLopener__tempfilesrvr_URLopener__unlink tempcacheftpcache)rrx509rs rfrzURLopener.__init__Ws47>@W6XY c-!<<<< ? llGw''DD)DDD' ,, +..($,78  ! rgc.|dSri)rrs rf__del__zURLopener.__del__qs rgc.|dSri)cleanuprs rfrzURLopener.closets rgc|jr:|jD](} ||#t$rY%wxYw|jdd=|jr|jdSdSri)rrrrr)rrks rfrzURLopener.cleanupws   $(  MM$''''D # > # N " " " " " # #s ( 55c:|j|dS)zdAdd a header to be used by the HTTP interface only e.g. u.addheader('Accept', 'sound/basic')N)rr})rrs rf addheaderzURLopener.addheaders  t$$$$$rgcBtt|}t|d}|jr:||jvr1|j|\}}t |d}t |||St |\}}|sd}||jvr6|j|}t |\}} t| \} } | |f}nd}d|z} ||_ | dd} t|| s/|r| |||S| ||S |t|| |St|| ||S#t$rt j$r(} t%t'd | Yd} ~ dSd} ~ wwxYw) z6Use URLopener().open(file) instead of open(file, 'r').z%/:=&?~#+!$,;'@()*[]|saferrkNopen_-rz socket error)rr'rrr r)rrrrrcropen_unknown_proxy open_unknownrrr/rrIOError)rrrarrrurltyper`r| proxyhostrrr{rs rfr zURLopener.opens'**++&=>>> > 4g77 $w 7 Hgh%%Bb'733 3 ))  G dl " "L)E!*5!1!1 GY&y11ND(/CCE  ||C%%tT"" 8 8..ugtDDD(($777 ?|*wtT**3///*wtT**3555    | ? ? ? !=!= > > > > > > > > > ?s(EEF6FFcHt|\}}tdd|)/Overridable interface to open unknown URL type. url errorzunknown url typerr)rrrarr`s rfrzURLopener.open_unknowns&g&& ck#5t<< 'cT^33>#& &s^^ d  T TV^^ ))$//wwyy #IdOOA$677==     YYsD ! !& ggiiG *8T** )#  )$*" 5 5  *4:2 6 6 g )$*" 5 5 g))$//2!1!1&!9!9X ''111iD)) !7*>-*0DN3'#w..w'7899D3JxT2227GGBKKE CJJ&DIIe$$$MH!7" 8R6667  HHJJJJBHHJJJJ 199&C, &(( ( s9A B88 C C &C J&BI7"J&7J  J&&J<c2d}d}t|tr8t|\}}|r!t|\}}t |}|}n|\}}t|\}}t |\} } | }d}| dkrd}nBt| \}} |rt|\}}|r | d|| }t|r|}|stdd|rIt |}tj |  d} nd} |rIt |}tj |  d} nd} ||} i}| rd| z|d<| rd| z|d <|r||d <d |d <|j D] \}}|||< |d |d<| d|||n| d|| | }n"#t j$rt%dwxYwd|jcxkrdkr"nnt)||jd|z|jS|||j|j|j|j|S)aMake 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. Nr(://z http errorr8rzBasic %sr,rrrrDr9z Content-TyperrrGz$http protocol error: bad status linerLrMhttp:)rrrr!rrrrrrrrrrrrIr7 BadStatusLinerstatusr)r http_errorrrK)rconnection_factoryr`ra user_passwd proxy_passwdrrrealhostrr proxy_authr http_connrheaderrrs rf_open_generic_httpzURLopener._open_generic_https2  c3   $&s^^ND( %$-dOO! Tt}}HH ND(!*4 L$%h//MGTCK}}&((!*4$@,5h,?,?)KG.5ggxxFH))$#DA7<AAA  "<00L),*=*=*?*?@@GGPPJJJ  !+..K#K$6$6$8$899@@IIDDD&&t,,   E-7*-DG) *  :(2T(9GO $  '&GFO !( !_ $ $MFE#GFOO  &IGN #   fhg > > > >   eXw  ? ? ? C ,,..HH( C C CABB B C (/ ' ' ' 'C ' ' ' ' 'h gm&o// /??X[(,FF Fs HH4cD|tj||S)zUse HTTP protocol.)r r7rTrr`ras rf open_httpzURLopener.open_httpXs&&{'A3MMMrgcd|z}t||r6t||}|||||||} n|||||||} | r| S||||||S)zHandle http errors. Derived class can override this, or provide specific handlers named http_error_DDD where DDD is the 3-digit error code.z http_error_%d)rrr+) rr`rerrcodeerrmsgrrar{rrs rfrzURLopener.http_error\s ( 4   %T4((F|R&'BBR&'4HH $f}&&sBIIIrgcP|t||||d)z>Default error handler: close the connection and raise IOError.N)rrrr`rrrrs rfr+zURLopener.http_error_defaultls%  Wfgt<<???t__ dt__ d   D 1 1vvft}}tzr""2&&#D))  MMM?DDt99Doo et}}zz##2#YRd 0Q0QRR .Q.3aD$. t}   + +]''))  88 a(A a(GGIII A$-''tVT4>> c" $ ) )(.. e::<<6))::: ;;==D M#.77dCCMR((#66q9EG 8/%77"w!||1G;;/88Gb'6C<88 8{{ A A A .3*>!?!? @ @ @ @ @ @ @ @ @ AsC7KL LL c t|tstd |dd\}}n#t$rt ddwxYw|sd}|d}|dkr$d ||d vr||dzd }|d |}nd }g}|d tj d tj tjz|d|z|dkr;tj | dd}nt|}|dt!|z|d ||d|}t%j|}t)j|}t-|||S)zUse "data" URL.zEdata error: proxy support for data protocol currently not implementedrsrz data errorz bad data URLztext/plain;charset=US-ASCII;rrmNrzDate: %sz%a, %d %b %Y %H:%M:%S GMTzContent-type: %srrzlatin-1zContent-Length: %d )rrrrrUrrfindr}rstrftimegmtimer decodebytesrrrrrrrioStringIOr)) rr`rarsemiencodingrrfs rf open_datazURLopener.open_datas#s## dbcc c 899S!,,LT44 8 8 8,77 7 8 10Dzz# 199DK//DFGG}H;DDH :dm,G,0K ,D,DFFF G G G %,--- x  %dkk'&:&:;;BB9MMDD4==D '#d))3444 2 4iinn+C00 K  !Wc***s AAriNNN)rrrrPrrrrrrrrr rrrr rrr+rTrrrrr&r3rrgrfrJrJJsK ;.G!!!!4 # # #%%% "?"?"?"?H==== IIII >>>>DZFZFZFxNNNNJJJJ === N E E E  N N N N--->>>@8A8A8At'+'+'+'+'+'+rgrJceZdZdZdZdZddZdZddZddZ dd Z dd Z dd Z dd Z ddZddZddZddZdZdS)rKz?Derived class with handlers for errors we can handle (perhaps).cZtj|g|Ri|i|_d|_d|_dS)NrrV)rJr auth_cachetriesmaxtries)rrkwargss rfrzFancyURLopener.__init__ s<41$111&111  rgc,t||d|z|S)z3Default error handling -- don't raise an exception.r)r)rs rfr+z!FancyURLopener.http_error_defaults"gw}g>>>rgNc|xjdz c_|jrE|j|jkr5t|dr|j}n|j}d|_|||dd|S|||||||}d|_|S)z%Error 302 -- relocated (temporarily).rhttp_error_500rrBz)Internal Server Error: Redirect Recursion)r8r9rr=r+redirect_internal) rr`rrrrrarrs rfrvzFancyURLopener.http_error_302s a = NTZ4=88t-.. /*.DJ4RCWNN N''R&'(,..  rgc$d|vr |d}nd|vr |d}ndS|t|jdz|z|}t|}|jdvrt |||d|zz||||S)Nrhrirrjz( Redirection to url '%s' is not allowed.)rrrrrorr ) rr`rrrrrardrss rfr>z FancyURLopener.redirect_internal%s  Z(FF g  U^FF F  S3.77F## ?"> > >FG"FOP#R)) ) yy   rgc6|||||||S)z*Error 301 -- also relocated (permanently).rvrr`rrrrras rfrwzFancyURLopener.http_error_301A ""3GVWdKKKrgc6|||||||S)z;Error 303 -- also relocated (essentially identical to 302).rArBs rfrxzFancyURLopener.http_error_303ErCrgcl||||||||S||||||S)z1Error 307 -- relocated, but turn POST into error.)rvr+rBs rfryzFancyURLopener.http_error_307IsA <&&sB$OO O**3GVWMM MrgFc*d|vrt|||||||d}tjd|} | st||||||| \} } | dkrt|||||||st||||||d|jzdz} |t|| || St|| || |S)z_Error 401 -- authentication required. This function supports Basic authentication only.r![ ]*([^ ]+)[ ]+realm="([^"]*)"rretry_ _basic_authrJr+rmatchrrrr rr`rrrrrar*stuffrKrorr{s rfrzFancyURLopener.http_error_401PsN W , ,  ( (sB)0&' C C C*+?GG C  ( (sB)0&' C C C   <<>>W $ $  ( (sB)0&' C C C   ( (sB   $)#m3 <%74%%c511 1%74%%c5$77 7rgc*d|vrt|||||||d}tjd|} | st||||||| \} } | dkrt|||||||st||||||d|jzdz} |t|| || St|| || |S)zeError 407 -- proxy authentication required. This function supports Basic authentication only.rrGr retry_proxy_rIrJrLs rfrzFancyURLopener.http_error_407isN w . .  ( (sB)0&' C C C,-?GG C  ( (sB)0&' C C C   <<>>W $ $  ( (sB)0&' C C C   ( (sB    )M9 <%74%%c511 1%74%%c5$77 7rgct|\}}d|z|z}|jd}t|\}} t| \} } | ddz} | | d} || || \} } | s| sdSt | ddt | dd| } d| z| z|jd<|||S|||S)Nhttp://r(@rrrrrrrrget_user_passwdrr rr`rrarrrdr|rr proxyselectorrrrs rfretry_proxy_http_basic_authz*FancyURLopener.retry_proxy_http_basic_auths"3hT!H, V$&u--#,Y#7#7 = NN3  ! #abbM ++Iua@@ f,,"'2"6"6"6"6"6"'R"8"8"8"8"8))E (94}D V <99V$$ $99VT** *rgct|\}}d|z|z}|jd}t|\}} t| \} } | ddz} | | d} || || \} } | s| sdSt | ddt | dd| } d| z| z|jd<|||S|||S)Nhttps://rrRrrrrrSrUs rfretry_proxy_https_basic_authz+FancyURLopener.retry_proxy_https_basic_auths"3hd"X- W%&u--#,Y#7#7 = NN3  ! #abbM ++Iua@@ f,,"'2"6"6"6"6"6"'R"8"8"8"8"8))E *Y 6 F W <99V$$ $99VT** *rgcdt|\}}|ddz}||d}||||\}}|s|sdSt|ddt|dd|}d|z|z} ||| S|| |S)NrRrrrrrQrrrTrr rr`rrarrrrrrds rfrz$FancyURLopener.retry_http_basic_auths"3h IIcNNQ ABBx++D%;; f,,"4b11111"633333TT;T!H, <99V$$ $99VT** *rgcdt|\}}|ddz}||d}||||\}}|s|sdSt|ddt|dd|}d|z|z} ||| S|| |S)NrRrrrrrYr\r]s rfretry_https_basic_authz%FancyURLopener.retry_https_basic_auths"3h IIcNNQ ABBx++D%;; f,,"4b11111"633333TT;d"X- <99V$$ $99VT** *rgrc|dz|z}||jvr|r |j|=n |j|S|||\}}|s|r ||f|j|<||fS)NrR)rr7prompt_user_passwd)rrrrrrrs rfrTzFancyURLopener.get_user_passwdsckDJJLL( $/ ! ! ,OC((s++..tU;; f @6@4.4?3/V|rgc ddl} td|d|d}|d|d|d|d}||fS#t$rtYdSwxYw) z#Override this in a GUI environment!rNzEnter username for z at z: zEnter password for z in r)getpassr KeyboardInterruptprint)rrrrcrrs rfraz!FancyURLopener.prompt_user_passwds 5EEE444HIID___uuuddd&$%%F<      GGG:: s8?AAri)NFrQ)rrrrPrr+rvr>rwrxryrrrWrZrr_rTrarrgrfrKrKsRII ??? !!!8LLLLLLLLNNNNFJ88882FJ88882++++$++++$ + + + + + + + +         rgrKcFttjdatS)z8Return the IP address of the magic hostname 'localhost'.Nr}) _localhostr/rrrgrfr}r}s )+66 rgc tv ttjtjdan<#tj$r*ttjddaYnwxYwtS)z,Return the IP addresses of the current host.Nr)r}) _thishostrr/rrrrrgrfrrs Gf5f6H6J6JKKANOOII G G Gf5kBB1EFFIII G s8A6A;:A;c4t ddl}|jatS)z1Return the set of errors raised by the FTP class.Nr) _ftperrorsrr)rs rfr%r%s! & rgcFttjdatS)z%Return an empty email Message object.Nr) _noheadersrrrrgrf noheadersrns .r22 rgcBeZdZdZ d dZdZdZdZdZd Z d Z dS) rz;Class used by open_ftp() for cache of open FTP connections.NTc||_||_||_||_||_||_d|_||_|dSr) rrrrrrbrefcount keepaliveinit)rrrrrrrbrs rfrzftpwrapper.__init__ sK       # rgcVddl}d|_||_|j|j|j|j|j|j |j d |j }|j |dS)Nrrl)rbusyFTPrkconnectrrrbloginrrrrcwd)rr_targets rfrszftpwrapper.init s  ::<< DIt|<<< ty$+...((49%%  Wrgclddl}||dvrd}d}nd|z}d} |j|n>#|j$r1||j|YnwxYwd}|rw|su d|z}|j|\}}nQ#|j$rD}t|dddkrttd |zYd}~nd}~wwxYw|s|jd|r|j } |j |n-#|j$r }td |z} || _ | d}~wwxYw |j | n#|j | wxYwd |z}nd }|j|\}}d|_t|d |j} |xjdz c_|| |fS) Nr)r$rzTYPE ArzTYPE zRETR rL550rzLIST LISTr)r endtransferrkvoidcmdrrs ntransfercmd error_permrrrpwdry __cause__rur*makefile file_closerqr) rrkrrcmdisdirrrrKrrftpobjs rfrzftpwrapper.retrfile s   :  XsquudNcAE " H  S ! ! ! !  " " " IIKKK H  S ! ! ! ! ! "  M M Mn $ 5 5c : : gg$ M M Mv;;rr?e++(/F2J)K)KLLL M 7 H  X & & & hllnn &" T****!,"""''?@@(. ! "+HLL%%%%DHLL%%%%n H11#66MD' dmmD114?CC     sSA8B?B "B-- C;7:C66C;7EF E<E77E<<FF7cd|_dSr)rurs rfr~zftpwrapper.endtransferK s  rgcVd|_|jdkr|dSdS)NFr)rrrq real_closers rfrzftpwrapper.closeN s4 =A   OO       rgc||xjdzc_|jdkr|js|dSdSdS)Nrr)r~rqrrrrs rfrzftpwrapper.file_closeS s\   =A  dn  OO         rgc| |jdS#t$rYdSwxYwri)r~rkrr%rs rfrzftpwrapper.real_closeY sW   HNN     {{    DD s1AA)NT) rrrrPrrsrr~rrrrrgrfrr sEE?C     .!.!.!`  rgrci}tjD]6\}}|}|r|dddkr |||dd<7|S)aReturn a dictionary of scheme -> proxy server URL mappings. Scan the environment for variables named _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. iN_proxy)rvenvironrr)rr{rs rfgetproxies_environmentra siGz''))'' ezz||  'T"##Y(**!&GD"I  Nrgc`tjddptjdd}|dkrdSt|\}}d|dD}|D]1}|r-||s||rdS2dS) zTest 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. no_proxyrNO_PROXY*rc6g|]}|Srru)r^r|s rfrz,proxy_bypass_environment..~ s DDDuU[[]]DDDrgrsr)rvrrr rendswith)rrhostonlyr no_proxy_listr{s rfproxy_bypass_environmentrq s z~~j"--O B1O1OH3qt__NHdDDs0C0CDDDM  X&&t,,  d0C0C 11 1rgcpddlm}t|\}}d}d|vr |drdSd}|dd D]}|stjd |}||6 t j|}||}n#t j$rYPwxYw||d } |d } | /d |d  dd zz} nt| d d} d| z } || z | | z krdS|||rdSdS)aj 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'] } r)fnmatchc |d}ttt|}t |dkr|gdzdd}|ddz|ddzz|dd zz|d zS) N.rU)rrrrrrrr)rrL)rrr r r)ipAddrrs rfip2numz,_proxy_bypass_macosx_sysconf..ip2num s S!!Se__%% u::??\\\)2A2.EaB58r>2eAh!mDuQxOOrgrexclude_simpleTN exceptionsrz(\d+(?:\.\d+)*)(/\d+)?rr)r F) rr rrrKr/rrgroupcountr ) rproxy_settingsrrrrhostIPrrermasks rf_proxy_bypass_macosx_sysconfr s t__NHdPPP $ * + 4 F##L"55h H. 6 6 =~#1(;;F#VF^^FF|H6!''!**%%D771::D|AGGAJJ,,S11A5648}}9D$DDL11tt2WT5 ! ! 44  5s!BBBdarwin)_get_proxy_settings _get_proxiesc>t}t||Sri)rr)rrs rfproxy_bypass_macosx_sysconfr s,..+D.AAArgctS)zReturn a dictionary of scheme -> proxy server URL mappings. This function uses the MacOSX framework SystemConfiguration to fetch the proxy information. )rrrgrfgetproxies_macosx_sysconfr s ~~rgcZtrt|St|Sri)rrrrs rfrr s, ! # # 5+D11 1.t44 4rgc:tp tSri)rrrrgrfrGrG s%''F+D+F+FFrgcji} ddl}n#t$r|cYSwxYw ||jd}||dd}|rt ||dd}d|vrS|dD]<}|dd\}}tjd |s|d |}|||<=n,|dd d kr||d <nd|z|d <d|z|d<d|z|d<| n#tttf$rYnwxYw|S)zxReturn a dictionary of scheme -> proxy server URL mappings. Win32 uses the registry to store proxies. rN;Software\Microsoft\Windows\CurrentVersion\Internet Settings ProxyEnable ProxyServerrmr(rz ^([^/:]+)://rrrr(z http://%sz https://%srzftp://%srk) winreg ImportErrorOpenKeyHKEY_CURRENT_USER QueryValueExrrrrKClose WindowsErrorrUr)rrinternetSettings proxyEnable proxyServerpr addresss rfgetproxies_registryr s   MMMM   NNN  %~~f.FN P P  --.>/<>>>?AK B!&"5"56F7D#F#FFG#IJJ +%%(..s3344,-GGCOO)'!x@@F3;88WW&EG,3)) 4#2A2'11*5*5 *C+7++E()3k)A  " " $ $ $ $j)4    D   s C9DD0/D0c:tp tSzReturn a dictionary of scheme -> proxy server URL mappings. Returns settings gathered from the environment, if specified, or the registry. )rrrrgrfrGrG s&''@+>+@+@@rgc ddl}n#t$rYdSwxYw ||jd}||dd}t ||dd}n#t $rYdSwxYw|r|sdSt|\}}|g} tj |}||kr| |n#tj $rYnwxYw tj |}||kr| |n#tj $rYnwxYw| d}|D]z} | dkrd|vrdS| dd } | d d } | d d} |D]&} tj| | tjrdS'{dS) Nrrr ProxyOverrider(zrrz\.rz.*?)rrrrrrrr r/rr}rgetfqdnrrcrrKr) rrrr proxyOverriderawHostraddrfqdnrrs rfproxy_bypass_registryr s_  MMMM   11  %~~f.FN P P  --.>/<>>>?AK 3 34D5D!F!FFG!IJJMM   11  - 1!$ y '00Dw D!!!|    D  >'**Dw D!!!|    D  &++C00 !  Dy  g%%11<<U++D<<U++D<<T**D  8D#rt,,111 qsB A A:: BB'/CC)(C)-/DD/.D/cZtrt|St|Sr)rrrrs rfrrH s. " # # /+D11 1(.. .rgr4)rP __future__rrrrfuture.builtinsrrr r r r r r future.utilsrrrrrrr:future.backportsrfuture.backports.httprr7rrrrparserrrrrrrrr r!r"r#r$r%r&r'r(rr)r*r.rvrrr/sysrryrsr collectionsr+collections.abcrVr,rTr__all__rrr_r0rBrCr|rHrIrASCIIrrobjectr-r.rDr/rAr0r1rr3r4r5r6r7r8urandomrr9r:r;r/r<rr^r}r2r@rrr=rr>r?r$r{ nturl2pathrFrErrJrKrgr}rirrkr%rmrnrrrrplatform_scproxyrrrrrrGrrrrgrfrs FFlSRRRRRRRRRRRKKKKKKKKKKKKKKKKKKKK7777777777  """"""777777<<<<<<<<<<GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG/.......  )$$$$$$$((((((JJJIIIII    "k"1"o F$B++++4====~   (2:h11LL2:h''L"w"w"w"w"w"fw"w"w"rN+N+N+N+N+VN+N+N+h$$$L88888&888&########";;;;;k;;;e2e2e2e2e2+e2e2e2PF,F,F,P(>(>(>(>(>;(>(>(>T=====f===@GGGGGoGGGBBBBBvBBBJ     3[        4k   "z JJJJJJJJZK)B$     [*C   wwwww+wwwt33333%333 7;)**# 8 8 8 8 8* 8 8 8 NN>"""#####+###$66666[666 )*)*)*V2121212121+212121h 8,8,8,8,8,8,8,8,t33333j333p 7d??555555555!!!  {+{+{+{+{+{+{+{+| OOOOOYOOOh     [[[[[[[[|    .999x<8::::::::BBB555 GGGGGW__+++ZAAA000d / / / / /(J+LLLs? C CC