ó zfc@sßdZddlZddlZddlZddlZddlZddlZddlZddlm Z dddddd d d d d ddddddddddddddddddgZ d Z d!Z ejd"krødd#lmZmZn:ejd$kr dd#lmZmZnd%„Zd&„Zeaeeed'„Zeeeed(„Zd)„ZyddlZWn eZnXeZd*efd+„ƒYZiZdfd,„ƒYZdefd-„ƒYZ ea!d.„Z"ea#d/„Z$ea%d0„Z&ea'd1„Z(d2fd3„ƒYZ)d4fd5„ƒYZ*d6e*fd7„ƒYZ+d8e*fd9„ƒYZ,d:e*fd;„ƒYZ-ye.Wne/k r›d<„Z0n Xd=„Z0d>„Z1d?„Z2ea3d@„Z4ea5dA„Z6ea7dB„Z8ea9dC„Z:ea;dD„Z<ea=ddE„Z>ea?dF„Z@eaAdG„ZBdH„ZCeaDdI„ZEdJZFeGdK„eFDƒƒZHejIdLƒZJdM„ZKdN„ZLdOZMiZNxfeOePdPƒeQeRePdPƒƒƒƒD]=\ZSZTeSdQkoÜeTeMkråeTn dRjUeSƒeNeT|j |||ƒS|j||ƒSny9|d krst|| ƒ|ƒSt|| ƒ||ƒSWn2tjk r¾} td | ftjƒd ‚nXd S( s6Use URLopener().open(file) instead of open(file, 'r').tsafes%/:=&?~#+!$,;'@()*[]|trbRLtopen_t-t_topen_local_files socket erroriN(RttoBytesRRGR't addinfourlRR"RR%ttypetreplaceR>topen_unknown_proxyt open_unknowntgetattrtsocketterrorR3tsystexc_info(R6tfullurlR)R,theaderstfpturltypeR(tproxyt proxyhostthosttselectortnametmsg((s/usr/lib64/python2.7/urllib.pyR'·s8     cCs(t|ƒ\}}tdd|f‚dS(s/Overridable interface to open unknown URL type.s url errorsunknown url typeN(RR3(R6RaR)RXR(((s/usr/lib64/python2.7/urllib.pyR[ÝscCs,t|ƒ\}}tdd||f‚dS(s/Overridable interface to open unknown URL type.s url errorsinvalid proxy for %sN(RR3(R6ReRaR)RXR(((s/usr/lib64/python2.7/urllib.pyRZâscCsætt|ƒƒ}|jr5||jkr5|j|St|ƒ\}}|dkrÀ| sf|dkrÀyC|j|ƒ}|jƒ}|jƒtt |ƒdƒ|fSWqÀt k r¼qÀXn|j ||ƒ}zÎ|jƒ} |rùt |dƒ} n³ddl } t|ƒ\} } t | p#dƒ\} } t | p;dƒ\} } t| pSdƒ\} } tjj| ƒd}| j|ƒ\}}|jj|ƒtj|dƒ} zå|| f}|jdk rÚ||j|R\R%thttp_error_default( R6R(RcR�RžRbR)RitmethodR}((s/usr/lib64/python2.7/urllib.pyR•rs  cCs#|jƒtd|||f‚dS(s>Default error handler: close the connection and raise IOError.s http errorN(RIR3(R6R(RcR�RžRb((s/usr/lib64/python2.7/urllib.pyR �s c CsFddl}d}d}t|tƒrit|ƒ\}}|r`t|ƒ\}}t|ƒ}n|}n |\}}t|ƒ\}}t|ƒ\} } | }d}| jƒdkrÀd}nIt| ƒ\}} |rít|ƒ\}}n|r d| || f}n|st d‚n|rEt|ƒ}t j |ƒj ƒ} nd} |rut|ƒ}t j |ƒj ƒ} nd} |j |dd|jd |jd |jƒ} |dk rñ| jd |ƒ| jd d ƒ| jddt|ƒƒn| jd|ƒ| r| jdd| ƒn| r;| jdd| ƒn|rT| jd|ƒnx|jD]}| j|Œq^W| j|ƒ| jƒ\}}}| jƒ}|dkrÎ|rÂ|jƒnt d‚nd|koådknrt||d||ƒS|dkr&|j|||||ƒS|j||||||ƒSdS(sUse HTTPS protocol.iÿÿÿÿNthttpss %s://%s%ss https errors no host giveniR;R<R#Rƒs Content-Types!application/x-www-form-urlencodedsContent-Lengths%dR„sProxy-AuthorizationsBasic %sR…R†shttp protocol errorsgot a bad status lineiÈi,shttps:(s https errors no host given(shttp protocol errorisgot a bad status lineN(R‡R%RˆR‰RRRRRŠR3RŒR�RŽtHTTPSR;R<R#R�R‘RuRBR’R“R”RIRWR•(R6R(R)R‡R–R—RgRhR˜RdR™RšR›RœRNR�RžRbRc((s/usr/lib64/python2.7/urllib.pyt open_https‡s~                  cCsut|tƒstd ‚n|d dkrd|dd!dkrd|dd!jƒdkrd|j|ƒS|j|ƒSd S( s/Use local file or FTP depending on form of URL.s file errors9proxy support for file protocol currently not implementedis//it/i s localhost/N(s file errors9proxy support for file protocol currently not implemented(RˆR‰R3RŠtopen_ftpRU(R6R(((s/usr/lib64/python2.7/urllib.pyt open_fileÐs  < cCsddl}ddl}ddl}yddlm}Wn!tk r[ddlm}nXt|ƒ\}}t|ƒ}ytj |ƒ} Wn.t k r½} t | j | j | jƒ‚nX| j} |jj| jdtƒ} |j|ƒd} |j|d| p d| | fƒƒ}|s‚|}|d d krFd |}n#|d d kritd |ƒ‚ntt|dƒ||ƒSt|ƒ\}}| røtj|ƒtƒtƒfkrø|}|d d krßd |}ntt|dƒ||ƒSt d‚dS(sUse local file.iÿÿÿÿN(tStringIOtusegmtis6Content-Type: %s Content-Length: %d Last-modified: %s s text/plainiR¥sfile://is./sAlocal file url may start with / or file:. Unknown url of type: %sRQslocal file errorsnot on local host(slocal file errorsnot on local host(t mimetypest mimetoolst email.utilst cStringIOR¨t ImportErrorRR RDtstatRKR3terrnotstrerrorR,tst_sizetutilst formatdatetst_mtimetTruet guess_typetMessaget ValueErrorRWR'RR]t gethostbynameRR(R6R(RªR«temailR¨RgRLt localnametstatsteRtmodifiedtmtypeRbturlfiletport((s/usr/lib64/python2.7/urllib.pyRUÙsD$      !  cCs¤t|tƒstd‚nddl}ddl}yddlm}Wn!tk rjddlm}nXt|ƒ\}}|s�td‚nt |ƒ\}}t |ƒ\}}|rÎt |ƒ\}} nd} t |ƒ}|péd}| põd} tj|ƒ}|s%ddl} | j}n t|ƒ}t|ƒ\}} t |ƒ}|jdƒ} | d | d} } | r‘| d  r‘| d } n| r¯| d  r¯d| d cBs¶eZdZd„Zd„Zdd„Zd„Zdd„Zdd„Z dd„Z dd„Z dd „Z dd „Z dd „Zdd „Zdd „Zdd„Zd„ZRS(s?Derived class with handlers for errors we can handle (perhaps).cOs2tj|||Ži|_d|_d|_dS(Nii (RR4t auth_cachettriestmaxtries(R6RNtkwargs((s/usr/lib64/python2.7/urllib.pyR4ms  cCst||d||ƒS(s3Default error handling -- don't raise an exception.shttp:(RW(R6R(RcR�RžRb((s/usr/lib64/python2.7/urllib.pyR ssc Cs›|jd7_z{|jrg|j|jkrgt|dƒrH|j}n |j}|||dd|ƒS|j||||||ƒ}|SWdd|_XdS(s%Error 302 -- relocated (temporarily).ithttp_error_500iôs)Internal Server Error: Redirect RecursionNi(RìRíR>RïR tredirect_internal( R6R(RcR�RžRbR)tmethR}((s/usr/lib64/python2.7/urllib.pythttp_error_302ws    c CsÀd|kr|d}nd|kr2|d}ndS|jƒt|jd||ƒ}|jƒ}|jdƒp�|jdƒp�|jdƒs³td||d||ƒ‚n|j|ƒS( Ntlocationturit:shttp://shttps://sftp://sredirect errors) - Redirection to url '%s' is not allowed(RIRRXRŠt startswithR3R'( R6R(RcR�RžRbR)tnewurlt newurl_lower((s/usr/lib64/python2.7/urllib.pyRð‰s         cCs|j||||||ƒS(s*Error 301 -- also relocated (permanently).(Rò(R6R(RcR�RžRbR)((s/usr/lib64/python2.7/urllib.pythttp_error_301¡scCs|j||||||ƒS(s;Error 303 -- also relocated (essentially identical to 302).(Rò(R6R(RcR�RžRbR)((s/usr/lib64/python2.7/urllib.pythttp_error_303¥scCsE|dkr(|j||||||ƒS|j|||||ƒSdS(s1Error 307 -- relocated, but turn POST into error.N(R%RòR (R6R(RcR�RžRbR)((s/usr/lib64/python2.7/urllib.pythttp_error_307©s c Cs d|kr+tj||||||ƒn|d}ddl}|jd|ƒ} | sxtj||||||ƒn| jƒ\} } | jƒdkr»tj||||||ƒnd|jd} |dkrît|| ƒ|| ƒSt|| ƒ|| |ƒSdS(s_Error 401 -- authentication required. This function supports Basic authentication only.swww-authenticateiÿÿÿÿNs![ ]*([^ ]+)[ ]+realm="([^"]*)"tbasictretry_t _basic_auth( RR tretmatchtgroupsRŠRXR%R\( R6R(RcR�RžRbR)tstuffRÿRtschemetrealmRi((s/usr/lib64/python2.7/urllib.pythttp_error_401°s"    c Cs d|kr+tj||||||ƒn|d}ddl}|jd|ƒ} | sxtj||||||ƒn| jƒ\} } | jƒdkr»tj||||||ƒnd|jd} |dkrît|| ƒ|| ƒSt|| ƒ|| |ƒSdS(seError 407 -- proxy authentication required. This function supports Basic authentication only.sproxy-authenticateiÿÿÿÿNs![ ]*([^ ]+)[ ]+realm="([^"]*)"Rüt retry_proxy_Rþ( RR RÿRRRŠRXR%R\( R6R(RcR�RžRbR)RRÿRRRRi((s/usr/lib64/python2.7/urllib.pythttp_error_407Æs"    cCs t|ƒ\}}d||}|jd}t|ƒ\}} t| ƒ\} } | jdƒd} | | } |j| || ƒ\} } | p’| s™dSt| ddƒdt| ddƒd| } d| | |jd<|dkrõ|j|ƒS|j||ƒSdS(Nshttp://R‚t@iRPRlRõ(RR"Rtfindtget_user_passwdR%RR'(R6R(RR)RgRhR÷ReRdRft proxyselectorRÇRÒRÓ((s/usr/lib64/python2.7/urllib.pytretry_proxy_http_basic_authÜs   .  cCs t|ƒ\}}d||}|jd}t|ƒ\}} t| ƒ\} } | jdƒd} | | } |j| || ƒ\} } | p’| s™dSt| ddƒdt| ddƒd| } d| | |jd<|dkrõ|j|ƒS|j||ƒSdS(Nshttps://R¢RiRPRlRõ(RR"RR R R%RR'(R6R(RR)RgRhR÷ReRdRfR RÇRÒRÓ((s/usr/lib64/python2.7/urllib.pytretry_proxy_https_basic_authís   .  c CsÃt|ƒ\}}|jdƒd}||}|j|||ƒ\}}|pS|sZdSt|ddƒdt|ddƒd|}d||} |dkr¯|j| ƒS|j| |ƒSdS(NRiRPRlRõshttp://(RR R R%RR'( R6R(RR)RgRhRÇRÒRÓR÷((s/usr/lib64/python2.7/urllib.pytretry_http_basic_authþs  .  c CsÃt|ƒ\}}|jdƒd}||}|j|||ƒ\}}|pS|sZdSt|ddƒdt|ddƒd|}d||} |dkr¯|j| ƒS|j| |ƒSdS(NRiRPRlRõshttps://(RR R R%RR'( R6R(RR)RgRhRÇRÒRÓR÷((s/usr/lib64/python2.7/urllib.pytretry_https_basic_auth s  .  icCsˆ|d|jƒ}||jkrD|r6|j|=qD|j|Sn|j||ƒ\}}|sh|r~||f|j|ÎRlt__iter__tnext(RcRttreadlineR>R=R>R@RA(R6Rc((s/usr/lib64/python2.7/urllib.pyR4Æs  cCs d|jjt|ƒ|jfS(Ns<%s at %r whose fp = %r>(t __class__R8tidRc(R6((s/usr/lib64/python2.7/urllib.pyt__repr__Ôs cCsJd|_d|_d|_d|_|jr=|jjƒnd|_dS(N(R%RtRBR=R>RcRI(R6((s/usr/lib64/python2.7/urllib.pyRIØs     (R8R9RèR4RERI(((s/usr/lib64/python2.7/urllib.pyR<Ãs  R0cBs eZdZd„Zd„ZRS(s*Class to add a close hook to an open file.cGs&tj||ƒ||_||_dS(N(R<R4t closehookthookargs(R6RcRFRG((s/usr/lib64/python2.7/urllib.pyR4ãs cCsPz;|j}|j}|r:d|_d|_||ŒnWdtj|ƒXdS(N(RFRGR%R<RI(R6RFRG((s/usr/lib64/python2.7/urllib.pyRIès    (R8R9RèR4RI(((s/usr/lib64/python2.7/urllib.pyR0às taddinfocBs eZdZd„Zd„ZRS(s.class to add an info() method to an open file.cCstj||ƒ||_dS(N(R<R4Rb(R6RcRb((s/usr/lib64/python2.7/urllib.pyR4÷scCs|jS(N(Rb(R6((s/usr/lib64/python2.7/urllib.pyRmûs(R8R9RèR4Rm(((s/usr/lib64/python2.7/urllib.pyRHôs RWcBs5eZdZdd„Zd„Zd„Zd„ZRS(s9class to add info() and geturl() methods to an open file.cCs/tj||ƒ||_||_||_dS(N(R<R4RbR(tcode(R6RcRbR(RI((s/usr/lib64/python2.7/urllib.pyR4s  cCs|jS(N(Rb(R6((s/usr/lib64/python2.7/urllib.pyRmscCs|jS(N(RI(R6((s/usr/lib64/python2.7/urllib.pytgetcode scCs|jS(N(R((R6((s/usr/lib64/python2.7/urllib.pytgeturl sN(R8R9RèR%R4RmRJRK(((s/usr/lib64/python2.7/urllib.pyRWþs    cCsdS(Ni((tx((s/usr/lib64/python2.7/urllib.pyt _is_unicode#scCs t|tƒS(N(Rˆtunicode(RL((s/usr/lib64/python2.7/urllib.pyRM&scCsTt|ƒrPy|jdƒ}WqPtk rLtdt|ƒdƒ‚qPXn|S(stoBytes(u"URL") --> 'URL'.tASCIIsURL s contains non-ASCII characters(RMtencodet UnicodeErrortrepr(R(((s/usr/lib64/python2.7/urllib.pyRV)s  cCsi|jƒ}|d dkrB|ddkrB|dd!jƒ}n|d dkre|djƒ}n|S(s8unwrap('') --> 'type://host/path'.itisURL:(RŽ(R(((s/usr/lib64/python2.7/urllib.pyR5s   cCsvtdkr*ddl}|jdƒantj|ƒ}|rl|jdƒ}|jƒ|t|ƒdfSd|fS(s:splittype('type:opaquestring') --> 'type', 'opaquestring'.iÿÿÿÿNs ^([^/:]+):i(t _typeprogR%RÿtcompileRtgroupRŠRu(R(RÿRR((s/usr/lib64/python2.7/urllib.pyR>s  cCsŽtdkr$tjdtjƒantj|ƒ}|r„|jdƒ}|jdƒ}|rz|jdƒ rzd|}n||fSd|fS(s;splithost('//host[:port]/path') --> 'host[:port]', '/path'.s//([^/#?]*)(.*)iiR¥N(t _hostprogR%RÿRVtDOTALLRRWRö(R(Rt host_portRo((s/usr/lib64/python2.7/urllib.pyRLs   cCsYtdkr*ddl}|jdƒantj|ƒ}|rO|jddƒSd|fS(sJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.iÿÿÿÿNs ^(.*)@(.*)$ii(t _userprogR%RÿRVRRW(RgRÿR((s/usr/lib64/python2.7/urllib.pyR\s  cCs_tdkr0ddl}|jd|jƒantj|ƒ}|rU|jddƒS|dfS(s/splitpasswd('user:passwd') -> 'user', 'passwd'.iÿÿÿÿNs^([^:]*):(.*)$ii(t _passwdprogR%RÿRVtSRRW(RÒRÿR((s/usr/lib64/python2.7/urllib.pyRhs  cCsntdkr*ddl}|jdƒantj|ƒ}|rd|jƒ\}}|rd||fSn|dfS(s*splitport('host:port') --> 'host', 'port'.iÿÿÿÿNs^(.*):([0-9]*)$(t _portprogR%RÿRVRR(RgRÿRRÂ((s/usr/lib64/python2.7/urllib.pyRus   cCsžtdkr*ddl}|jdƒantj|ƒ}|r”|jddƒ\}}|r”yt|ƒ}Wntk r†d}nX||fSn||fS(sÛSplit host and port, returning numeric port. Return given default port if no ':' found; defaults to -1. Return numerical port if a valid number are found after ':'. Return None if ':' but not a valid number.iÿÿÿÿNs ^(.*):(.*)$ii(t _nportprogR%RÿRVRRWRsR¹(RgtdefportRÿRRÂtnport((s/usr/lib64/python2.7/urllib.pyR„s     cCsYtdkr*ddl}|jdƒantj|ƒ}|rO|jddƒS|dfS(s/splitquery('/path?query') --> '/path', 'query'.iÿÿÿÿNs^(.*)\?([^?]*)$ii(t _queryprogR%RÿRVRRW(R(RÿR((s/usr/lib64/python2.7/urllib.pyRšs  cCsYtdkr*ddl}|jdƒantj|ƒ}|rO|jddƒS|dfS(s)splittag('/path#tag') --> '/path', 'tag'.iÿÿÿÿNs^(.*)#([^#]*)$ii(t_tagprogR%RÿRVRRW(R(RÿR((s/usr/lib64/python2.7/urllib.pyR ¦s  cCs!|jdƒ}|d|dfS(sksplitattr('/path;attr1=value1;attr2=value2;...') -> '/path', ['attr1=value1', 'attr2=value2', ...].RÝii(RË(R(twords((s/usr/lib64/python2.7/urllib.pyR±scCsYtdkr*ddl}|jdƒantj|ƒ}|rO|jddƒS|dfS(s-splitvalue('attr=value') --> 'attr', 'value'.iÿÿÿÿNs^([^=]*)=(.*)$ii(t _valueprogR%RÿRVRRW(RÙRÿR((s/usr/lib64/python2.7/urllib.pyR¸s  t0123456789ABCDEFabcdefccs?|]5}tD](}||tt||dƒƒfVq qdS(iN(t_hexdigtchrRs(t.0RÅtb((s/usr/lib64/python2.7/urllib.pys Èss([-]+)cCsOt|ƒr¦d|kr|Stj|ƒ}|dg}|j}xUtdt|ƒdƒD];}|tt||ƒƒjdƒƒ|||dƒqZWdj |ƒS|jdƒ}t|ƒdkrË|S|dg}|j}x^|dD]R}y$|t |d ƒ||dƒWqìt k r=|dƒ||ƒqìXqìWdj |ƒS(s"unquote('abc%20def') -> 'abc def'.t%iiitlatin1Rl( RMt_asciireRËRMtrangeRuRR‰tdecodeRÌt _hextochrtKeyError(tstbitstresRMRÇtitem((s/usr/lib64/python2.7/urllib.pyRÌs.    #     cCs|jddƒ}t|ƒS(s%unquote('%7e/abc+def') -> '~/abc def't+t (RYR(Rr((s/usr/lib64/python2.7/urllib.pyR èssAABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-ii€s%{:02X}R¥cCs×|s%|dkr!tdƒ‚n|S|tf}yt|\}}Wnftk r­tjƒ}|jg|D]}||f^qnƒ|j}t|}||ft| 'abc%20def' Each part of a URL, e.g. the path info, the query, etc., has a different set of reserved characters that must be quoted. RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists the following reserved characters. reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," Each of these characters is reserved in some component of a URL, but not necessarily in all of them. By default, the quote function is intended for quoting the path section of a URL. Thus, it will not encode '/'. This character is reserved, but in typical usage the quote function is being called on a path where the existing slash characters are used as reserved characters. sNone object cannot be quotedRlN( R%t TypeErrort always_safeR/Rqt _safe_maptcopytupdatet __getitem__trstripRÌtmap(RrRPtcachekeytquotertsafe_maptc((s/usr/lib64/python2.7/urllib.pyRõs     &  RlcCs<d|kr/t||dƒ}|jddƒSt||ƒS(s9Quote the query fragment of a URL; replacing ' ' with '+'RwRv(RRY(RrRP((s/usr/lib64/python2.7/urllib.pyRs ic Csÿt|dƒr|jƒ}nby-t|ƒrJt|dtƒ rJt‚nWn2tk rtjƒ\}}}td|‚nXg}|sßxc|D]E\}}tt |ƒƒ}tt |ƒƒ}|j |d|ƒq“Wnx|D]\}}tt |ƒƒ}t|t ƒr7t|ƒ}|j |d|ƒqæt |ƒrst|j ddƒƒ}|j |d|ƒqæyt|ƒWn8tk r»tt |ƒƒ}|j |d|ƒqæXx/|D]'}|j |dtt |ƒƒƒqÃWqæWdj |ƒS(svEncode a sequence of two-element tuples or dictionary into a URL query string. If any values in the query arg are sequences and doseq is true, each sequence element is converted to a separate parameter. If the query arg is a sequence of two-element tuples, the order of the parameters in the output will match the order of parameters in the input. titemsis1not a valid non-string sequence or mapping objectRÞRORYt&(R>R„RuRˆttupleRxR_R`RR‰RMRMRPRÌ( tquerytdoseqttytvattbtlR×RØtelt((s/usr/lib64/python2.7/urllib.pyR #s<        )cCséi}xPtjjƒD]?\}}|jƒ}|r|ddkr|||d proxy server URL mappings. Scan the environment for variables named _proxy; this seems to be the standard convention. In order to prefer lowercase variables, we process the environment in two passes, first matches any and second matches only lower case proxies. If you need a different way, you can pass a proxies dictionary to the [Fancy]URLopener constructor. iúÿÿÿt_proxytREQUEST_METHODR‚N(RDtenvironR„RŠtpopR%(R"RiRÚ((s/usr/lib64/python2.7/urllib.pytgetproxies_environmentcs   c Csÿ|dkrtƒ}ny|d}Wntk r:dSX|dkrKdSt|ƒ\}}g|jdƒD]}|jƒ^qm}xs|D]k}|rŒ|jdƒ}tj|ƒ}d|}tj ||tj ƒsðtj ||tj ƒr÷dSqŒqŒWdS( sÈTest if proxies should not be used for a particular host. Checks the proxies dict for the value of no_proxy, which should be a list of comma separated DNS suffixes, or '*' for all hosts. tnoit*iRÜt.s (.+\.)?%s$N( R%R’RqRRËRŽtlstripRÿtescapeRRÄ( RgR"tno_proxythostonlyRÂRet no_proxy_listRitpattern((s/usr/lib64/python2.7/urllib.pytproxy_bypass_environment‡s&    (   tdarwin(t_get_proxy_settingst _get_proxiesc Cs�ddl}ddl}ddlm}t|ƒ\}}d„}tƒ}d|kri|dritSnd}x'|jdd ƒD]} | s”q‚n|jd| ƒ} | dk r‚|dkrúy|j |ƒ}||ƒ}Wqú|j k röq‚qúXn|| j d ƒƒ} | j d ƒ} | dkrMd | j d ƒj dƒd } nt | d ƒ} d | } || ?| | ?kr•tSq‚||| ƒr‚tSq‚WtS(s¼ Return True iff this host shouldn't be accessed using a proxy This function uses the MacOSX framework SystemConfiguration to fetch the proxy information. iÿÿÿÿN(tfnmatchcSsy|jdƒ}tt|ƒ}t|ƒdkrM|ddddgd }n|dd>|dd>B|dd>B|d BS( NR•iiiiiiii(RËRRsRu(tipAddrtparts((s/usr/lib64/python2.7/urllib.pytip2num·s R•texclude_simplet exceptionss(\d+(?:\.\d+)*)(/\d+)?iiii ((RÿR]R RRžR¶R%R@RRºR^RWtcountRsR9( RgRÿR]R R™RÂR£tproxy_settingsthostIPRÚtmtbasetmask((s/usr/lib64/python2.7/urllib.pytproxy_bypass_macosx_sysconfªs@          # cCstƒS(s±Return a dictionary of scheme -> proxy server URL mappings. This function uses the MacOSX framework SystemConfiguration to fetch the proxy information. (RŸ(((s/usr/lib64/python2.7/urllib.pytgetproxies_macosx_sysconfåscCs*tƒ}|rt||ƒSt|ƒSdS(s¹Return True, if a host should be bypassed. Checks proxy settings gathered from the environment, if specified, or from the MacOSX framework SystemConfiguration. N(R’RœR¬(RgR"((s/usr/lib64/python2.7/urllib.pyR‹ís  cCstƒptƒS(N(R’R­(((s/usr/lib64/python2.7/urllib.pyRùsc Csmi}yddl}Wntk r*|SXy!|j|jdƒ}|j|dƒd}|rAt|j|dƒdƒ}d|kr÷x´|jdƒD]Y}|jdd ƒ\}}ddl}|jd |ƒsæd ||f}n||| proxy server URL mappings. Win32 uses the registry to store proxies. iÿÿÿÿNs;Software\Microsoft\Windows\CurrentVersion\Internet Settingst ProxyEnableit ProxyServerRÞRÝis ^([^/:]+)://s%s://%sishttp:R‚s http://%ss https://%sR¢sftp://%sR$( t_winregR®tOpenKeytHKEY_CURRENT_USERt QueryValueExR‰RËRÿRtCloset WindowsErrorR¹Rx( R"R°tinternetSettingst proxyEnablet proxyServertptprotocoltaddressRÿ((s/usr/lib64/python2.7/urllib.pytgetproxies_registryýs:         cCstƒptƒS(s¥Return a dictionary of scheme -> proxy server URL mappings. Returns settings gathered from the environment, if specified, or the registry. (R’R¼(((s/usr/lib64/python2.7/urllib.pyR+sc Csðyddl}ddl}Wntk r0dSXyK|j|jdƒ}|j|dƒd}t|j|dƒdƒ}Wntk r�dSX| sŸ| r£dSt|ƒ\}}|g}y/t j |ƒ}||krì|j |ƒnWnt j k rnXy/t j |ƒ} | |kr2|j | ƒnWnt j k rInX|jdƒ}x�|D]ˆ} | dkr…d|kr…d Sn| jdd ƒ} | jd d ƒ} | jd dƒ} x*|D]"} |j| | |jƒrÂd SqÂWq`WdS(Niÿÿÿÿis;Software\Microsoft\Windows\CurrentVersion\Internet SettingsR®t ProxyOverrideRÝsR•is\.R”s.*t?(R°RÿR®R±R²R³R‰RµRR]RºRMR^tgetfqdnRËRYRRÄ( RgR°RÿR¶R·t proxyOverridetrawHostRÂtaddrtfqdnttesttval((s/usr/lib64/python2.7/urllib.pytproxy_bypass_registry4sT                cCs*tƒ}|rt||ƒSt|ƒSdS(sšReturn True, if the host should be bypassed. Checks proxy settings gathered from the environment, if specified, or the registry. N(R’RœRÆ(RgR"((s/usr/lib64/python2.7/urllib.pyR‹hs  cCs¶d}x$tdƒD]}|t|ƒ}qW|d}tjƒ}t|ƒ}t|ƒ}tjƒ}||kr{dGHnt|ƒGHt|ƒGHt|ƒGHt||dƒGdGHdS(NRliisWrong!itsec(RnRhRàRRRRtround(RrRÇtt0tqstuqstt1((s/usr/lib64/python2.7/urllib.pyttest1zs         cCsd|||fGHdS(Ns0Block number: %d, Block size: %d, Total size: %d((R€t blocksizet totalsize((s/usr/lib64/python2.7/urllib.pyR-Šs(hRètstringR]RDRàR_RŒRÿturlparseRRt__all__RéRÍRit nturl2pathR R t rourl2pathR%R&RRRtsslR9RêR¶R3R2R1RRRRRRRRRRRÏR<R0RHRWRNt NameErrorRMRVRRURRXRR[RR\RR^RR_RRbRRcR RReRRgtdictRpRVRmRR RyRztziptxrangeR‰t bytearrayRÇRƒtformatR/RRR R’Rœtplatformt_scproxyRžRŸR¬R­R‹RR¼RÆRÍR-(((s/usr/lib64/python2.7/urllib.pytsÖ               ÿóÉ    c "                 45 '  @ $  ;   . 4