Files
PowerToys/PythonHome/Lib/urllib.pyc

349 lines
52 KiB
Plaintext
Raw Normal View History

2014-07-09 18:15:23 +08:00
<03>
<EFBFBD>W`Sc@s<>dZddlZddlZddlZddlZddlZddlZddlZddlm Z
dddddd d
d d d ddddddddddddddddddgZ d Z d!Z ejd"kr<>dd#lmZmZn:ejd$kr dd#lmZmZnd%<00>Zd&<00>Zeaeed'<00>Zeeed(<00>Zd)<00>ZyddlZWn eZnXeZd*efd+<00><00>YZiZdfd,<00><00>YZdefd-<00><00>YZ ea!d.<00>Z"ea#d/<00>Z$ea%d0<00>Z&ea'd1<00>Z(d2fd3<00><00>YZ)d4fd5<00><00>YZ*d6e*fd7<00><00>YZ+d8e*fd9<00><00>YZ,d:e*fd;<00><00>YZ-ye.Wne/k
r<>d<<00>Z0n
Xd=<00>Z0d><00>Z1d?<00>Z2ea3d@<00>Z4ea5dA<00>Z6ea7dB<00>Z8ea9dC<00>Z:ea;dD<00>Z<ea=ddE<00>Z>ea?dF<00>Z@eaAdG<00>ZBdH<00>ZCeaDdI<00>ZEdJZFeGdK<00>eFD<><00>ZHejIdL<00>ZJdM<00>ZKdN<00>ZLdOZMiZNxfeOePdP<00>eQeRePdP<00><00><00><00>D]=\ZSZTeSdQko<>eTeMkr<>eTn dRjUeS<00>eNeT<q<>WiZVdSdT<00>ZWdUdV<00>ZXdWdX<00>ZYdY<00>ZZdZ<00>Z[ej\d[kr~dd\l]m^Z^m_Z_d]<00>Z`d^<00>Zad_<00>Zbd`<00>ZcnBejd"kr<>da<00>Zddb<00>Zcdc<00>Zedd<00>Zbn eZZce[Zbde<00>Zfdf<00>ZgdS(gs<>Open an arbitrary URL.
See the following document for more info on URLs:
"Names and Addresses, URIs, URLs, URNs, URCs", at
http://www.w3.org/pub/WWW/Addressing/Overview.html
See also the HTTP spec (from which the error codes are derived):
"HTTP - Hypertext Transfer Protocol", at
http://www.w3.org/pub/WWW/Protocols/
Related standards and specs:
- RFC1808: the "relative URL" spec. (authoritative status)
- RFC1738 - the "URL standard". (authoritative status)
- RFC1630 - the "URI spec". (informational status)
The object returned by URLopener().open(file) will differ per
protocol. All you know is that is has methods read(), readline(),
readlines(), fileno(), close() and info(). The read*(), fileno()
and close() methods work like those of open files.
The info() method returns a mimetools.Message object which can be
used to query various info about the object, if available.
(mimetools.Message objects are queried with the getheader() method.)
i<EFBFBD><EFBFBD><EFBFBD><EFBFBD>N(turljointurlopent URLopenertFancyURLopenert urlretrievet
urlcleanuptquotet
quote_plustunquotet unquote_plust urlencodet url2pathnamet pathname2urltsplittagt localhosttthishostt ftperrorstbasejointunwrapt splittypet splithostt splitusert splitpasswdt splitportt
splitnportt
splitqueryt splitattrt
splitvaluet
getproxiess1.17i
tnt(R R triscoscCs
t|<00>S(sOS-specific conversion from a relative URL of the 'file' scheme
2014-07-10 23:57:08 +08:00
to a file system path; not recommended for general use.(R(tpathname((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR 5scCs
2014-07-09 18:15:23 +08:00
t|<00>S(sOS-specific conversion from a file system path to a relative URL
2014-07-10 23:57:08 +08:00
of the 'file' scheme; not recommended for general use.(R(R((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR :scCs<>ddlm}|ddd<00>|dk r>td|<00>}ntsVt<00>}|ant}|dkru|j|<00>S|j||<00>SdS(s=Create a file-like object for the specified URL to read from.i<><69><EFBFBD><EFBFBD>(twarnpy3ksMurllib.urlopen() has been removed in Python 3.0 in favor of urllib2.urlopen()t
2014-07-09 18:15:23 +08:00
stacklevelitproxiesN(twarningsR tNoneRt
2014-07-10 23:57:08 +08:00
_urlopenertopen(turltdataR"R topener((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRHs      cCs(tst<00>antj||||<00>S(N(R%Rtretrieve(R'tfilenamet
reporthookR(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRZs cCs+trtj<00>ntj<00>tj<00>dS(N(R%tcleanupt _safe_quoterstcleartftpcache(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR_s 
tContentTooShortErrorcBseZd<00>ZRS(cCstj||<00>||_dS(N(tIOErrort__init__tcontent(tselftmessageR4((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR3os(t__name__t
__module__R3(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR1nscBs<>eZdZdZdeZdd<00>Zd<00>Zd<00>Z d<00>Z
2014-07-09 18:15:23 +08:00
d<00>Z dd<00>Z dd<00>Z dd <00>Zdddd
<00>Zdd <00>Zdd <00>Zd <00>Zer<>dd<00>Znd<00>Zd<00>Zd<00>Zdd<00>ZRS(s,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).sPython-urllib/%scKs<>|dkrt<00>}nt|d<00>s3td<00><00>||_|jd<00>|_|jd<00>|_d|jfg|_ g|_
t j |_ d|_t|_dS(Nthas_keysproxies must be a mappingtkey_filet cert_files
User-Agent(R$RthasattrtAssertionErrorR"tgetR:R;tversiont
2014-07-10 23:57:08 +08:00
addheaderst_URLopener__tempfilestostunlinkt_URLopener__unlinkt tempcacheR0(R5R"tx509((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR3<00>s      cCs|j<00>dS(N(tclose(R5((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyt__del__<5F>scCs|j<00>dS(N(R-(R5((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRG<00>scCsi|jrLx6|jD]+}y|j|<00>Wqtk
r=qXqW|j2n|jre|jj<00>ndS(N(RARDtOSErrorRER/(R5tfile((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR-<00>s  
2014-07-09 18:15:23 +08:00
 cGs|jj|<00>dS(sdAdd a header to be used by the HTTP interface only
2014-07-10 23:57:08 +08:00
e.g. u.addheader('Accept', 'sound/basic')N(R@tappend(R5targs((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyt addheader<65>scCs<>tt|<00><00>}t|dd<00>}|jrn||jkrn|j|\}}t|d<00>}t|||<00>St|<00>\}}|s<>d}n||jkr<>|j|}t|<00>\}} t| <00>\}
2014-07-09 18:15:23 +08:00
} |
|f}nd
}d|} ||_
| j dd<00>} t || <00>sD|r1|j |||<00>S|j||<00>Sny9|d
krft|| <00>|<00>St|| <00>||<00>SWn2tjk
r<>} td| ftj<00>d <19>nXd
S( s6Use URLopener().open(file) instead of open(file, 'r').tsafes%/:=&?~#+!$,;'@()*[]|trbRJtopen_t-t_s socket erroriN(RttoBytesRRER&t
2014-07-10 23:57:08 +08:00
addinfourlRR"RR$ttypetreplaceR<topen_unknown_proxyt open_unknowntgetattrtsocketterrorR2tsystexc_info(R5tfullurlR(R+theaderstfpturltypeR'tproxyt proxyhostthosttselectortnametmsg((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR&<00>s8  
  cCs(t|<00>\}}tdd|f<00>dS(s/Overridable interface to open unknown URL type.s url errorsunknown url typeN(RR2(R5R^R(RUR'((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRX<00>scCs,t|<00>\}}tdd||f<00>dS(s/Overridable interface to open unknown URL type.s url errorsinvalid proxy for %sN(RR2(R5RbR^R(RUR'((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRW<00>sc
Cs<>tt|<00><00>}|jr5||jkr5|j|St|<00>\}}|dkr<>| sf|dkr<>yC|j|<00>}|j<00>}|j<00>tt |<00>d<19>|fSWq<57>t
2014-07-09 18:15:23 +08:00
k
r<>q<>Xn|j ||<00>}z<>|j<00>} |r<>t |d<00>}
n<>ddl } t|<00>\} } t | p#d<00>\} } t | p;d<00>\} } t| pSd<00>\} } tjj| <00>d}| j|<00>\}}|jj|<00>tj|d<00>}
z<>|| f}|jdk r<>||j|<nd }d}d }d }d
| krt| d <19>}n|r*||||<00>nxb|j|<00>}|dkrLPn|t|<00>7}|
j|<00>|d7}|r-||||<00>q-q-Wd|
j<00>XWd|j<00>X|d kr<>||kr<>td ||f|<00><00>n|S(stretrieve(url) returns (filename, headers) for a local object
2014-07-10 23:57:08 +08:00
or (tempfilename, headers) for a remote object.RJitwbi<62><69><EFBFBD><EFBFBD>Ntiiiscontent-lengthsContent-Lengths1retrieval incomplete: got only %i out of %i bytesi (RRSRERR$topen_local_filetinfoRGR RR2R&ttempfileRRRBtpathtsplitexttmkstempRARKtfdopentinttreadtlentwriteR1(R5R'R+R,R(RUturl1R`thdrsR_ttfpRltgarbageRmtsuffixtfdtresulttbstsizeRrtblocknumtblock((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR*<00>sj  
2014-07-09 18:15:23 +08:00
       
2014-07-10 23:57:08 +08:00
 cCs=ddl}d}d}t|t<00>rit|<00>\}}|r`t|<00>\}}t|<00>}n|}n<>|\}}t|<00>\}}t|<00>\} }
2014-07-09 18:15:23 +08:00
|
}d}| j<00>dkr<>d}n^t|
<00>\}}
|r<>t|<00>\}}n|r d| ||
f}nt |<00>r|}n|s0t
d<00>n|rZt|<00>}t j |<00>j <00>} nd} |r<>t|<00>}t j |<00>j <00>} nd} |j|<00>} |dk r<>| jd|<00>| jdd <00>| jd
d t|<00><16>n| jd |<00>| r| jd d| <16>n| r2| jdd| <16>n|rK| jd|<00>nx|jD]}| j|<00>qUW| j|<00>| j<00>\}}}| j<00>}|dkr<>|r<>|j<00>nt
d<00>nd|ko<>dknr<>t||d||<00>S|dkr|j|||||<00>S|j||||||<00>SdS(sUse HTTP protocol.i<><69><EFBFBD><EFBFBD>Nthttps %s://%s%ss
http errors no host giventPOSTs Content-Types!application/x-www-form-urlencodedsContent-Lengths%dtGETsProxy-AuthorizationsBasic %st AuthorizationtHostshttp protocol errorisgot a bad status linei<65>i,shttp:(s
http errors no host given(shttp protocol errorisgot a bad status lineN(thttplibR$t
isinstancetstrRRRRtlowert proxy_bypassR2tbase64t b64encodetstriptHTTPt
putrequestt putheaderRsR@t
endheaderstgetreplytgetfileRGRTt
http_error(R5R'R(R<>t user_passwdt proxy_passwdRdRetrealhostRatrestt
2014-07-10 23:57:08 +08:00
proxy_authtauththRLterrcodeterrmsgR_R`((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyt open_http"sx                c
2014-07-09 18:15:23 +08:00
Cs<>d|}t||<00>rwt||<00>}|dkrO||||||<00>} n|||||||<00>} | rw| Sn|j|||||<00>S(s<>Handle http errors.
Derived class can override this, or provide specific handlers
named http_error_DDD where DDD is the 3-digit error code.s http_error_%dN(R<RYR$thttp_error_default(
2014-07-10 23:57:08 +08:00
R5R'R`R<>R<>R_R(RftmethodR{((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<79>ks
2014-07-09 18:15:23 +08:00
 cCs#|j<00>td|||f<00>dS(s>Default error handler: close the connection and raise IOError.s
2014-07-10 23:57:08 +08:00
http errorN(RGR2(R5R'R`R<>R<>R_((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<79>zs
cCs=ddl}d}d}t|t<00>rit|<00>\}}|r`t|<00>\}}t|<00>}n|}n<>|\}}t|<00>\}}t|<00>\} }
2014-07-09 18:15:23 +08:00
|
}d}| j<00>dkr<>d}nIt|
<00>\}}
|r<>t|<00>\}}n|r d| ||
f}n|st d<00>n|rEt|<00>}t
j |<00>j <00>} nd} |rut|<00>}t
j |<00>j <00>} nd} |j |dd|jd |j<00>} |dk r<>| jd
2014-07-10 23:57:08 +08:00
|<00>| jd d <00>| jd dt|<00><16>n| jd|<00>| r| jdd| <16>n| r2| jdd| <16>n|rK| jd|<00>nx|jD]}| j|<00>qUW| j|<00>| j<00>\}}}| j<00>}|dkr<>|r<>|j<00>nt d<00>nd|ko<>dknr<>t||d||<00>S|dkr|j|||||<00>S|j||||||<00>SdS(sUse HTTPS protocol.i<><69><EFBFBD><EFBFBD>Nthttpss %s://%s%ss https errors no host giveniR:R;R<>s Content-Types!application/x-www-form-urlencodedsContent-Lengths%dR<64>sProxy-AuthorizationsBasic %sR<73>R<>shttp protocol errorsgot a bad status linei<65>i,shttps:(s https errors no host given(shttp protocol errorisgot a bad status lineN(R<>R$R<>R<>RRRRR<>R2R<>R<>R<>tHTTPSR:R;R<>R<>RsR@R<>R<>R<>RGRTR<>(R5R'R(R<>R<>R<>RdReR<>RaR<>R<>R<>R<>RLR<>R<>R_R`((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyt
open_https<70>s|                 cCsut|t<00>std
2014-07-09 18:15:23 +08:00
<00>n|d dkrd|dd!dkrd|dd!j<00>dkrd|j|<00>S|j|<00>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
2014-07-10 23:57:08 +08:00
file errors9proxy support for file protocol currently not implemented(R<>R<>R2R<>topen_ftpRj(R5R'((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyt open_file<6C>s
 < cCsddl}ddl}ddl}yddlm}Wn!tk
2014-07-09 18:15:23 +08:00
r[ddlm}nXt|<00>\}}t|<00>}ytj |<00>} Wn.t
k
r<>}
t |
j |
j |
j<00><00>nX| j} |jj| jdt<00>} |j|<00>d} |j|d| p
d| | f<16><00>}|s<>|}|d d krFd
|}n#|d d kritd |<16><00>ntt|d<00>||<00>St|<00>\}}| r<>tj|<00>t<00>t<00>fkr<>|}|d d kr<>d
|}ntt|d<00>||<00>St d<00>dS(sUse local file.i<><69><EFBFBD><EFBFBD>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: %sROslocal file errorsnot on local host(slocal file errorsnot on local host(t mimetypest mimetoolst email.utilst cStringIOR<4F>t ImportErrorRR RBtstatRIR2terrnotstrerrorR+tst_sizetutilst
formatdatetst_mtimetTruet
guess_typetMessaget
2014-07-10 23:57:08 +08:00
ValueErrorRTR&RRZt gethostbynameRR(R5R'R<>R<>temailR<6C>RdRJt localnametstatsteR}tmodifiedtmtypeR_turlfiletport((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRj<00>sD$     
2014-07-09 18:15:23 +08:00
! 
2014-07-10 23:57:08 +08:00
c Cs<>t|t<00>std<00>nddl}ddl}yddlm}Wn!tk
2014-07-09 18:15:23 +08:00
rjddlm}nXt|<00>\}}|s<>td<00>nt |<00>\}}t
|<00>\}}|r<>t |<00>\}} nd} t |<00>}|p<>d}| p<>d} tj|<00>}|s%ddl}
|
j}n t|<00>}t|<00>\}} t |<00>}|jd<00>} | d | d} } | r<>| d  r<>| d
} n| r<>| d  r<>d| d <n|||dj| <00>f}t|j<00>tkr,xJ|jj<00>D]6}||kr<>|j|}|j|=|j<00>q<>q<>Wny?||jkr`t|| ||| <00>|j|<n| sod }nd }xM| D]E}t|<00>\}}|j<00>d kr||dkr||j<00>}q|q|W|j|j| |<00>\}}|j d|<17>d }d}|r|d|7}n|dk rA|d krA|d|7}n|j!||<00><00>}t"||d|<17>SWn2t#<00>k
r<>}td|ft$j%<00>d<19>nXdS(sUse FTP protocol.s ftp errors8proxy support for ftp protocol currently not implementedi<64><69><EFBFBD><EFBFBD>N(R<>s no host givenRiR<>iitDtIRUtatAtitdsftp:sContent-Type: %s
sContent-Length: %d
i(s ftp errors8proxy support for ftp protocol currently not implemented(s ftp errors no host given(R<>R<>R<>R<>R<>R<>(&R<>R<>R2R<>R<>R<>R<>R<>RRRRR$RRZR<>tftplibtFTP_PORTRqRtsplittjoinRsR0t MAXFTPCACHEtkeysRGt
2014-07-10 23:57:08 +08:00
ftpwrapperRR<>tuppertretrfileR<65>R<>RTRR\R](R5R'R<>R<>R<>RdRmR<>tusertpasswdR<64>tattrstdirsRJtkeytktvRUtattrtvalueR`tretrlenR<6E>R_Rg((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<79><00>sx              
"   c Cs<>t|t<00>std<00>nddl}yddlm}Wn!tk
2014-07-09 18:15:23 +08:00
r^ddlm}nXy|jdd<00>\}}Wntk
r<>td<00>nX|s<>d }n|j d
<00>}|d kr<>d ||kr<>||d}|| }nd }g}|j
dt j dt j t j <00><00><00><16>|j
d|<16>|dkrTtj|<00>}n t|<00>}|j
dt|<00><16>|j
d <00>|j
|<00>dj|<00>}||<00>} |j| d <00>}
t| |
|<00>S(sUse "data" URL.s
data errors9proxy support for data protocol currently not implementedi<64><69><EFBFBD><EFBFBD>N(R<>t,is bad data URLstext/plain;charset=US-ASCIIt;it=RisDate: %ss%a, %d %b %Y %H:%M:%S GMTsContent-type: %sR<73>sContent-Length: %ds
(s
data errors9proxy support for data protocol currently not implemented(s
2014-07-10 23:57:08 +08:00
data errors bad data URL(R<>R<>R2R<>R<>R<>R<>R<>R<>trfindRKttimetstrftimetgmtimeR<65>t decodestringRRsR<>R<>RT( R5R'R(R<>R<>RUtsemitencodingRgtfR_((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyt open_data4s@            N(R7R8t__doc__R$RAt __version__R?R3RHRGR-RMR&RXRWR*R<>R<>R<>t _have_sslR<6C>R<>RjR<>R<>(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRts*
2014-07-09 18:15:23 +08:00
      $  A I  H % >cBs<>eZdZd<00>Zd<00>Zdd<00>Zd<00>Zdd<00>Zdd<00>Z dd<00>Z
dd<00>Z dd <00>Z dd
<00>Z dd <00>Zdd <00>Zdd <00>Zdd<00>Zd<00>ZRS(s?Derived class with handlers for errors we can handle (perhaps).cOs2tj|||<00>i|_d|_d|_dS(Nii
(RR3t
2014-07-10 23:57:08 +08:00
auth_cachettriestmaxtries(R5RLtkwargs((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR3es  cCst||d||<00>S(s3Default error handling -- don't raise an exception.shttp:(RT(R5R'R`R<>R<>R_((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<79>ksc Cs<>|jd7_|jrm|j|jkrmt|d<00>rE|j}n |j}d|_|||dd|<00>S|j||||||<00>}d|_|S(s%Error 302 -- relocated (temporarily).ithttp_error_500ii<>s)Internal Server Error: Redirect Recursion(R<>R<>R<R<>R<>tredirect_internal( R5R'R`R<>R<>R_R(tmethR{((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pythttp_error_302os    
  c Cs<>d|kr|d}nd|kr2|d}ndS|j<00>t|jd||<00>}|j<00>}|jd<00>p<>|jd<00>p<>|jd<00>s<>td||d||<00><00>n|j|<00>S( Ntlocationturit:shttp://shttps://sftp://sredirect errors) - Redirection to url '%s' is not allowed(RGRRUR<>t
startswithR2R&( R5R'R`R<>R<>R_R(tnewurlt newurl_lower((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<79>s     
   cCs|j||||||<00>S(s*Error 301 -- also relocated (permanently).(R<>(R5R'R`R<>R<>R_R(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pythttp_error_301<30>scCs|j||||||<00>S(s;Error 303 -- also relocated (essentially identical to 302).(R<>(R5R'R`R<>R<>R_R(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pythttp_error_303<30>scCsE|dkr(|j||||||<00>S|j|||||<00>SdS(s1Error 307 -- relocated, but turn POST into error.N(R$R<>R<>(R5R'R`R<>R<>R_R(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pythttp_error_307<30>s c Cs d|kr+tj||||||<00>n|d}ddl}|jd|<00>} | sxtj||||||<00>n| j<00>\}
2014-07-09 18:15:23 +08:00
} |
j<00>dkr<>tj||||||<00>nd|jd} |dkr<>t|| <00>|| <00>St|| <00>|| |<00>SdS(s_Error 401 -- authentication required.
2014-07-10 23:57:08 +08:00
This function supports Basic authentication only.swww-authenticatei<65><69><EFBFBD><EFBFBD>Ns![ ]*([^ ]+)[ ]+realm="([^"]*)"tbasictretry_t _basic_auth( RR<>tretmatchtgroupsR<73>RUR$RY( R5R'R`R<>R<>R_R(tstuffR<66>R<>tschemetrealmRf((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pythttp_error_401<30>s" 
2014-07-09 18:15:23 +08:00
  c Cs d|kr+tj||||||<00>n|d}ddl}|jd|<00>} | sxtj||||||<00>n| j<00>\}
} |
j<00>dkr<>tj||||||<00>nd|jd} |dkr<>t|| <00>|| <00>St|| <00>|| |<00>SdS(seError 407 -- proxy authentication required.
2014-07-10 23:57:08 +08:00
This function supports Basic authentication only.sproxy-authenticatei<65><69><EFBFBD><EFBFBD>Ns![ ]*([^ ]+)[ ]+realm="([^"]*)"R<>t retry_proxy_R<5F>( RR<>R<>R<>R<>R<>RUR$RY( R5R'R`R<>R<>R_R(RR<>R<>RRRf((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pythttp_error_407<30>s" 
  cCs t|<00>\}}d||}|jd}t|<00>\}} t| <00>\} }
2014-07-09 18:15:23 +08:00
| jd<00>d} | | } |j| || <00>\} } | p<>| s<>dSt| dd<00>dt| dd<00>d| } d| |
2014-07-10 23:57:08 +08:00
|jd<|dkr<>|j|<00>S|j||<00>SdS(Nshttp://R<>t@iRNRiR<>(RR"Rtfindtget_user_passwdR$RR&(R5R'RR(RdReR<>RbRaRct proxyselectorR<72>R<>R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pytretry_proxy_http_basic_auth<74>s 
 .  cCs t|<00>\}}d||}|jd}t|<00>\}} t| <00>\} }
2014-07-09 18:15:23 +08:00
| jd<00>d} | | } |j| || <00>\} } | p<>| s<>dSt| dd<00>dt| dd<00>d| } d| |
2014-07-10 23:57:08 +08:00
|jd<|dkr<>|j|<00>S|j||<00>SdS(Nshttps://R<>RiRNRiR<>(RR"RRRR$RR&(R5R'RR(RdReR<>RbRaRcR R<>R<>R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pytretry_proxy_https_basic_auth<74>s 
2014-07-09 18:15:23 +08:00
 .  c
2014-07-10 23:57:08 +08:00
Cs<>t|<00>\}}|jd<00>d}||}|j|||<00>\}}|pS|sZdSt|dd<00>dt|dd<00>d|}d||} |dkr<>|j| <00>S|j| |<00>SdS(NRiRNRiR<>shttp://(RRRR$RR&(
R5R'RR(RdReR<>R<>R<>R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pytretry_http_basic_auth<74>s
2014-07-09 18:15:23 +08:00
 .  c
2014-07-10 23:57:08 +08:00
Cs<>t|<00>\}}|jd<00>d}||}|j|||<00>\}}|pS|sZdSt|dd<00>dt|dd<00>d|}d||} |dkr<>|j| <00>S|j| |<00>SdS(NRiRNRiR<>shttps://(RRRR$RR&(
R5R'RR(RdReR<>R<>R<>R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pytretry_https_basic_auths
 .  icCs<>|d|j<00>}||jkrD|r6|j|=qD|j|Sn|j||<00>\}}|sh|r~||f|j|<n||fS(NR(R<>R<>tprompt_user_passwd(R5RdRt clear_cacheR<65>R<>R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRs  cCsfddl}y@td||f<16>}|jd|||f<16>}||fSWntk
raHdSXdS(s#Override this in a GUI environment!i<><69><EFBFBD><EFBFBD>NsEnter username for %s at %s: s#Enter password for %s in %s at %s: (NN(tgetpasst raw_inputtKeyboardInterruptR$(R5RdRRR<>R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRs     N(R7R8R<>R3R<>R$R<>R<>R<>R<>R<>RRR
R R R RR(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRbs             cCs"tdkrtjd<00>antS(s8Return the IP address of the magic hostname 'localhost'.RN(t
_localhostR$RZR<>(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR*s cCsRtdkrNytjtj<00><00>aWqNtjk
rJtjd<00>aqNXntS(s*Return the IP address of the current host.RN(t _thishostR$RZR<>t gethostnametgaierror(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR2s  cCs(tdkr$ddl}|jantS(s1Return the set of errors raised by the FTP class.i<><69><EFBFBD><EFBFBD>N(t
2014-07-09 18:15:23 +08:00
_ftperrorsR$R<>t
2014-07-10 23:57:08 +08:00
all_errors(R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR=s   cCsytdkruddl}yddlm}Wn!tk
2014-07-09 18:15:23 +08:00
rOddlm}nX|j|<00>d<00>atjj<00>ntS(s)Return an empty mimetools.Message object.i<><69><EFBFBD><EFBFBD>N(R<>i( t
2014-07-10 23:57:08 +08:00
_noheadersR$R<>R<>R<>R<>R<>R`RG(R<>R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyt noheadersFs   R<>cBsVeZdZejed<00>Zd<00>Zd<00>Zd<00>Z d<00>Z
2014-07-09 18:15:23 +08:00
d<00>Z d<00>Z RS(s;Class used by open_ftp() for cache of open FTP connections.cCsV||_||_||_||_||_||_d|_||_|j<00>dS(Ni( R<>R<>RdR<>R<>ttimeouttrefcountt keepalivetinit(R5R<>R<>RdR<>R<>Rt
2014-07-10 23:57:08 +08:00
persistent((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR3Ys        cCs<>ddl}d|_|j<00>|_|jj|j|j|j<00>|jj|j |j
<00>dj |j <00>}|jj |<00>dS(Ni<4E><69><EFBFBD><EFBFBD>iR<>(R<>tbusytFTPtftptconnectRdR<>RtloginR<6E>R<>R<>R<>tcwd(R5R<>t_target((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRfs  c Csddl}|j<00>|dkr1d}d}nd|}d}y|jj|<00>Wn.|jk
2014-07-09 18:15:23 +08:00
r<>|j<00>|jj|<00>nXd}|r| ry&d|}|jj|<00>\}}Wq|jk
r }t |<00>d d
kr t
d |ft j <00>d <19>q qXn|s<>|jjd<00>|r<>|jj <00>} zMy|jj|<00>Wn2|jk
r<>}t
d |ft j <00>d <19>nXWd|jj| <00>Xd |}nd}|jj|<00>\}}nd|_t|jd<00>|j<00>}
|jd7_|j<00>|
|fS(Ni<4E><69><EFBFBD><EFBFBD>R<EFBFBD>R<>sTYPE AisTYPE isRETR it550s ftp errorisLIST tLISTRO(R<>R<>(R<>t endtransferR"tvoidcmdRRR$t ntransfercmdt
error_permR<6D>R2R\R]tpwdR%R t addclosehooktmakefilet
2014-07-10 23:57:08 +08:00
file_closeRRG( R5RJRUR<>tcmdtisdirtconnR<6E>treasonR-tftpobj((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<79>osL 
2014-07-09 18:15:23 +08:00
  

 
&$  
cCsB|js dSd|_y|jj<00>Wnt<00>k
2014-07-10 23:57:08 +08:00
r=nXdS(Ni(R R"tvoidrespR(R5((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR)<00>s  cCs)t|_|jdkr%|j<00>ndS(Ni(tFalseRRt
real_close(R5((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRG<00>s cCsC|j<00>|jd8_|jdkr?|j r?|j<00>ndS(Nii(R)RRR8(R5((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR0<00>s
2014-07-09 18:15:23 +08:00
cCs6|j<00>y|jj<00>Wnt<00>k
2014-07-10 23:57:08 +08:00
r1nXdS(N(R)R"RGR(R5((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR8<00>s
2014-07-09 18:15:23 +08:00

2014-07-10 23:57:08 +08:00
( R7R8R<>RZt_GLOBAL_DEFAULT_TIMEOUTR<54>R3RR<>R)RGR0R8(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<79>Vs +  taddbasecBs)eZdZd<00>Zd<00>Zd<00>ZRS(s(Base class for addinfo and addclosehook.cCs<>||_|jj|_|jj|_t|jd<00>rK|jj|_nt|jd<00>ro|jj|_n d<00>|_t|jd<00>r<>|jj|_t|jd<00>r<>|jj|_q<>ndS(Nt readlinestfilenocSsdS(N(R$(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyt<lambda><3E>st__iter__tnext(R`RrtreadlineR<R;R<R>R?(R5R`((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR3<00>s  cCs d|jjt|<00>|jfS(Ns<%s at %r whose fp = %r>(t __class__R7tidR`(R5((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyt__repr__<5F>s cCsJd|_d|_d|_d|_|jr=|jj<00>nd|_dS(N(R$RrR@R;R<R`RG(R5((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRG<00>s     (R7R8R<>R3RCRG(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR:<00>s  R.cBs eZdZd<00>Zd<00>ZRS(s*Class to add a close hook to an open file.cGs&tj||<00>||_||_dS(N(R:R3t closehookthookargs(R5R`RDRE((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR3<00>s cCs?|jr.|j|j<00>d|_d|_ntj|<00>dS(N(RDRER$R:RG(R5((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRG<00>s
   (R7R8R<>R3RG(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR.<00>s taddinfocBs eZdZd<00>Zd<00>ZRS(s.class to add an info() method to an open file.cCstj||<00>||_dS(N(R:R3R_(R5R`R_((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR3<00>scCs|jS(N(R_(R5((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRk<00>s(R7R8R<>R3Rk(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRF<00>s RTcBs5eZdZdd<00>Zd<00>Zd<00>Zd<00>ZRS(s9class to add info() and geturl() methods to an open file.cCs/tj||<00>||_||_||_dS(N(R:R3R_R'tcode(R5R`R_R'RG((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR3<00>s  cCs|jS(N(R_(R5((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRk<00>scCs|jS(N(RG(R5((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pytgetcode<64>scCs|jS(N(R'(R5((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pytgeturl<72>sN(R7R8R<>R$R3RkRHRI(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRT<00>s
   cCsdS(Ni((tx((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyt _is_unicodescCs t|t<00>S(N(R<>tunicode(RJ((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRKscCsTt|<00>rPy|jd<00>}WqPtk
rLtdt|<00>d<17><00>qPXn|S(stoBytes(u"URL") --> 'URL'.tASCIIsURL s contains non-ASCII characters(RKtencodet UnicodeErrortrepr(R'((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRSs  cCsi|j<00>}|d dkrB|ddkrB|dd!j<00>}n|d dkre|dj<00>}n|S(s8unwrap('<URL:type://host/path>') --> 'type://host/path'.it<i<><69><EFBFBD><EFBFBD>t>isURL:(R<>(R'((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR"s   cCsvtdkr*ddl}|jd<00>antj|<00>}|rl|jd<00>}|j<00>|t|<00>dfSd|fS(s:splittype('type:opaquestring') --> 'type', 'opaquestring'.i<><69><EFBFBD><EFBFBD>Ns
^([^/:]+):i(t _typeprogR$R<>tcompileR<65>tgroupR<70>Rs(R'R<>R<>R((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR+s  cCs<>tdkr*ddl}|jd<00>antj|<00>}|r<>|jd<00>}|jd<00>}|r<>|jd<00> r<>d|}n||fSd|fS(s;splithost('//host[:port]/path') --> 'host[:port]', '/path'.i<><69><EFBFBD><EFBFBD>Ns^//([^/?]*)(.*)$iiR<>(t _hostprogR$R<>RTR<>RUR<>(R'R<>R<>t host_portRm((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR9s   
cCsYtdkr*ddl}|jd<00>antj|<00>}|rO|jdd<00>Sd|fS(sJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.i<><69><EFBFBD><EFBFBD>Ns ^(.*)@(.*)$ii(t _userprogR$R<>RTR<>RU(RdR<>R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRJs  cCs_tdkr0ddl}|jd|j<00>antj|<00>}|rU|jdd<00>S|dfS(s/splitpasswd('user:passwd') -> 'user', 'passwd'.i<><69><EFBFBD><EFBFBD>Ns^([^:]*):(.*)$ii(t _passwdprogR$R<>RTtSR<53>RU(R<>R<>R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRVs  cCsntdkr*ddl}|jd<00>antj|<00>}|rd|j<00>\}}|rd||fSn|dfS(s*splitport('host:port') --> 'host', 'port'.i<><69><EFBFBD><EFBFBD>Ns^(.*):([0-9]*)$(t _portprogR$R<>RTR<>R<>(RdR<>R<>R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRcs   cCs<>tdkr*ddl}|jd<00>antj|<00>}|r<>|jdd<00>\}}|r<>yt|<00>}Wntk
2014-07-09 18:15:23 +08:00
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<><69><EFBFBD><EFBFBD>Ns ^(.*):(.*)$ii(t
2014-07-10 23:57:08 +08:00
_nportprogR$R<>RTR<>RURqR<>(RdtdefportR<74>R<>R<>tnport((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyRrs   
2014-07-09 18:15:23 +08:00
 cCsYtdkr*ddl}|jd<00>antj|<00>}|rO|jdd<00>S|dfS(s/splitquery('/path?query') --> '/path', 'query'.i<><69><EFBFBD><EFBFBD>Ns^(.*)\?([^?]*)$ii(t
2014-07-10 23:57:08 +08:00
_queryprogR$R<>RTR<>RU(R'R<>R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<00>s  cCsYtdkr*ddl}|jd<00>antj|<00>}|rO|jdd<00>S|dfS(s)splittag('/path#tag') --> '/path', 'tag'.i<><69><EFBFBD><EFBFBD>Ns^(.*)#([^#]*)$ii(t_tagprogR$R<>RTR<>RU(R'R<>R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR <00>s  cCs!|jd<00>}|d|dfS(sksplitattr('/path;attr1=value1;attr2=value2;...') ->
'/path', ['attr1=value1', 'attr2=value2', ...].R<>ii(R<>(R'twords((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<00>scCsYtdkr*ddl}|jd<00>antj|<00>}|rO|jdd<00>S|dfS(s-splitvalue('attr=value') --> 'attr', 'value'.i<><69><EFBFBD><EFBFBD>Ns^([^=]*)=(.*)$ii(t
_valueprogR$R<>RTR<>RU(R<>R<>R<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<00>s  t0123456789ABCDEFabcdefccs?|]5}tD](}||tt||d<00><00>fVq qdS(iN(t_hexdigtchrRq(t.0R<EFBFBD>tb((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pys <genexpr><3E>ss([-]+)cCsOt|<00>r<>d|kr|Stj|<00>}|dg}|j}xUtdt|<00>d<00>D];}|tt||<19><00>jd<00><00>|||d<19>qZWdj |<00>S|jd<00>}t|<00>dkr<>|S|dg}|j}x^|dD]R}y$|t
2014-07-09 18:15:23 +08:00
|d <19>||d<1F>Wq<57>t k
2014-07-10 23:57:08 +08:00
r=|d<00>||<00>q<>Xq<58>Wdj |<00>S(s"unquote('abc%20def') -> 'abc def'.t%iiitlatin1Ri( RKt_asciireR<65>RKtrangeRsRR<>tdecodeR<65>t _hextochrtKeyError(tstbitstresRKR<>titem((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<00>s.    #    
cCs|jdd<00>}t|<00>S(s%unquote('%7e/abc+def') -> '~/abc def't+t (RVR(Ro((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR <00>ssAABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-ii<>s%{:02X}R<>cCs<>|s%|dkr!td<00><00>n|S|tf}yt|\}}Wnftk
2014-07-09 18:15:23 +08:00
r<>tj<00>}|jg|D]}||f^qn<00>|j}t|}||ft|<nX|j |<00>s<>|Sdj
t ||<00><00>S(s quote('abc def') -> '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.
2014-07-10 23:57:08 +08:00
sNone object cannot be quotedRiN( R$t TypeErrort always_safeR.Rnt _safe_maptcopytupdatet __getitem__trstripR<70>tmap(RoRNtcachekeytquotertsafe_maptc((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<00>s     & 
RicCs<d|kr/t||d<17>}|jdd<00>St||<00>S(s9Quote the query fragment of a URL; replacing ' ' with '+'RtRs(RRV(RoRN((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR
s ic Cs<>t|d<00>r|j<00>}nby-t|<00>rJt|dt<00> rJt<00>nWn2tk
2014-07-09 18:15:23 +08:00
rtj<00>\}}}td|<00>nXg}|s<>xc|D]E\}}tt |<00><00>}tt |<00><00>}|j
|d|<17>q<>Wnx|D]\}}tt |<00><00>}t|t <00>r7t|<00>}|j
|d|<17>q<>t |<00>rst|j dd<00><00>}|j
|d|<17>q<>yt|<00>Wn8tk
r<>tt |<00><00>}|j
|d|<17>q<>Xx/|D]'}|j
|dtt |<00><00><17>q<>Wq<57>Wdj |<00>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.
2014-07-10 23:57:08 +08:00
titemsis1not a valid non-string sequence or mapping objectR<74>RMRVt&(R<R<>RsR<>ttupleRuR\R]RR<>RKRKRNR<>( tquerytdoseqttytvattbtlR<6C>R<>telt((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR
s<        )cCs]i}xPtjj<00>D]?\}}|j<00>}|r|ddkr|||d <qqW|S(sReturn a dictionary of scheme -> proxy server URL mappings.
2014-07-09 18:15:23 +08:00
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.
2014-07-10 23:57:08 +08:00
i<><69><EFBFBD><EFBFBD>t_proxy(RBtenvironR<6E>R<>(R"RfR<>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pytgetproxies_environmentQs  cCs<>tjjdd<00>p'tjjdd<00>}|dkr:dSt|<00>\}}g|jd<00>D]}|j<00>^q\}x6|D].}|r{|j|<00>s<>|j|<00>r{dSq{WdS(s<>Test if proxies should not be used for a particular host.
2014-07-09 18:15:23 +08:00
Checks the environment for a variable named no_proxy, which should
be a list of DNS suffixes separated by commas, or '*' for all hosts.
2014-07-10 23:57:08 +08:00
tno_proxyRitNO_PROXYt*iR<>i(RBR<>R>RR<>R<>tendswith(RdR<>thostonlyR<79>Rbt no_proxy_listRf((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pytproxy_bypass_environmentas* ( $tdarwin(t_get_proxy_settingst _get_proxiesc Cs<>ddl}ddl}ddlm}t|<00>\}}d<00>}t<00>}d|kri|dritSnd}x'|jdd <00>D]} | s<>q<>n|jd| <00>}
2014-07-09 18:15:23 +08:00
|
dk r<>|dkr<>y|j |<00>}||<00>}Wq<57>|j
k
r<>q<>q<>Xn||
j d <00><00>} |
j d
<00>} | dkrMd |
j d <00>j d<00>d } nt | d <1F>} d | } || ?| | ?kr<>tSq<53>||| <00>r<>tSq<53>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<><69><EFBFBD><EFBFBD>N(tfnmatchcSsy|jd<00>}tt|<00>}t|<00>dkrM|ddddgd }n|dd>|dd>B|dd>B|d BS(
2014-07-10 23:57:08 +08:00
Nt.iiiiiiii(R<>R|RqRs(tipAddrtparts((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pytip2num<75>s
2014-07-09 18:15:23 +08:00
R<>texclude_simplet
2014-07-10 23:57:08 +08:00
exceptionss(\d+(?:\.\d+)*)(/\d+)?iiii ((R<>RZR<>RR<>R<>R$R>R<>R<>R[RUtcountRqR7( RdR<>RZR<>R<>R<>R<>tproxy_settingsthostIPR<50>tmtbasetmask((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pytproxy_bypass_macosx_sysconfys@     
2014-07-09 18:15:23 +08:00
  
 #
cCst<00>S(s<>Return a dictionary of scheme -> proxy server URL mappings.
This function uses the MacOSX framework SystemConfiguration
to fetch the proxy information.
2014-07-10 23:57:08 +08:00
(R<>(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pytgetproxies_macosx_sysconf<6E>scCs!t<00>rt|<00>St|<00>SdS(N(R<>R<>R<>(Rd((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<79><00>s 
cCst<00>pt<00>S(N(R<>R<>(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<00>sc Csmi}yddl}Wntk
2014-07-09 18:15:23 +08:00
r*|SXy!|j|jd<00>}|j|d<00>d}|rAt|j|d<00>d<19>}d|kr<>x<>|jd<00>D]Y}|jdd <00>\}}ddl}|jd
|<00>s<>d ||f}n|||<q<>WqA|d d kr||d<qAd||d<d||d<d||d<n|j <00>Wnt
t t fk
rhnX|S(sxReturn a dictionary of scheme -> proxy server URL mappings.
Win32 uses the registry to store proxies.
i<><69><EFBFBD><EFBFBD>Ns;Software\Microsoft\Windows\CurrentVersion\Internet Settingst ProxyEnableit ProxyServerR<72>R<>is ^([^/:]+)://s%s://%sishttp:R<>s http://%ss
2014-07-10 23:57:08 +08:00
https://%sR<73>sftp://%sR"( t_winregR<67>tOpenKeytHKEY_CURRENT_USERt QueryValueExR<78>R<>R<>R<>tCloset WindowsErrorR<72>Ru( R"R<>tinternetSettingst proxyEnablet proxyServertptprotocoltaddressR<73>((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pytgetproxies_registry<72>s:         cCst<00>pt<00>S(s<>Return a dictionary of scheme -> proxy server URL mappings.
2014-07-09 18:15:23 +08:00
Returns settings gathered from the environment, if specified,
or the registry.
2014-07-10 23:57:08 +08:00
(R<>R<>(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<00>sc Cs<>yddl}ddl}Wntk
2014-07-09 18:15:23 +08:00
r0dSXyK|j|jd<00>}|j|d<00>d}t|j|d<00>d<19>}Wntk
r<>dSX| s<>| r<>dSt|<00>\}}|g}y/t j
|<00>}||kr<>|j |<00>nWnt j k
rnXy/t j |<00>} | |kr2|j | <00>nWnt j k
rInX|jd<00>}x<>|D]<5D>}
|
dkr<>d|kr<>d Sn|
jdd
<00>}
|
jd d <00>}
|
jd d<00>}
x*|D]"} |j|
2014-07-10 23:57:08 +08:00
| |j<00>r<>d Sq<53>Wq`WdS(Ni<4E><69><EFBFBD><EFBFBD>is;Software\Microsoft\Windows\CurrentVersion\Internet SettingsR<73>t ProxyOverrideR<65>s<local>R<>is\.R<>s.*t?(R<>R<>R<>R<>R<>R<>R<>R<>RRZR<>RKR[tgetfqdnR<6E>RVR<>R<>( RdR<>R<>R<>R<>t proxyOverridetrawHostR<74>taddrtfqdnttesttval((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pytproxy_bypass_registry<72>sT                cCs!t<00>rt|<00>St|<00>SdS(s<>Return a dictionary of scheme -> proxy server URL mappings.
2014-07-09 18:15:23 +08:00
Returns settings gathered from the environment, if specified,
or the registry.
2014-07-10 23:57:08 +08:00
N(R<>R<>R<>(Rd((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR<79>1s 
cCs<>d}x$td<00>D]}|t|<00>}qW|d}tj<00>}t|<00>}t|<00>}tj<00>}||kr{dGHnt|<00>GHt|<00>GHt|<00>GHt||d<00>GdGHdS(NRiiisWrong!itsec(RkReR<>RRRPtround(RoR<>tt0tqstuqstt1((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyttest1Cs
        cCsd|||fGHdS(Ns0Block number: %d, Block size: %d, Total size: %d((R~t blocksizet totalsize((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyR,Ss(hR<>tstringRZRBR<>R\R<>R<>turlparseRRt__all__R<5F>R<>Rft
2014-07-09 18:15:23 +08:00
nturl2pathR R t
rourl2pathR$R%RRRtsslR7R<>R<>R2R1R0RRRRRRRRRRR<>R:R.RFRTRLt NameErrorRKRSRRSRRVRRXRRYRR[RR\RR_RR`R RRbRRdtdictRmRTRjRR RvRwtziptxrangeR<65>t bytearrayR<79>R<>tformatR.RRR
2014-07-10 23:57:08 +08:00
R<>R<>tplatformt_scproxyR<79>R<>R<>R<>R<>RR<>R<>R<>R,(((s;e:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\urllib.pyt<module>s<>              
2014-07-09 18:15:23 +08:00
<13><00><16> 
  _
"                 45 '  @   ;    . 4