Files
PowerToys/PythonHome/Lib/_LWPCookieJar.pyc

59 lines
5.6 KiB
Plaintext
Raw Normal View History

2014-07-09 18:15:23 +08:00
<03>
<EFBFBD>W`Sc@s<>dZddlZddlZddlmZmZmZmZmZm Z m
Z
m Z m Z d<00>Z defd<00><00>YZdS(s<>Load / save to libwww-perl (LWP) format files.
Actually, the format is slightly extended from that used by LWP's
(libwww-perl's) HTTP::Cookies, to avoid losing some RFC 2965 information
not recorded by LWP.
It uses the version string "2.0", though really there isn't an LWP Cookies
2.0 format. This indicates that there is extra information in here
(domain_dot and # port_spec) while still being compatible with
libwww-perl, I hope.
i<EFBFBD><EFBFBD><EFBFBD><EFBFBD>N( t_warn_unhandled_exceptiont FileCookieJart LoadErrortCookietMISSING_FILENAME_TEXTtjoin_header_wordstsplit_header_wordstiso2timet time2isozcCs<>|j|jfd|jfd|jfg}|jd k rU|jd|jf<00>n|jrn|jd<00>n|jr<>|jd<00>n|j r<>|jd<00>n|j
r<>|jd<00>n|j r<>|jdt t |j <00><00>f<00>n|jr|jd<00>n|jr"|jd
|jf<00>n|jrD|jd |jf<00>n|jj<00>}|j<00>x.|D]&}|j|t|j|<19>f<00>qdW|jd t|j<00>f<00>t|g<00>S(s<>Return string representation of Cookie in an the LWP cookie file format.
Actually, the format is extended a bit -- see module docstring.
tpathtdomaintportt path_spect port_spect
domain_dottsecuretexpirestdiscardtcommentt
commenturltversionN(R N(R N(RN(ssecureN(sdiscardN(tnametvalueR R
2014-07-10 23:57:08 +08:00
R tNonetappendtpath_specifiedtport_specifiedtdomain_initial_dotRRRtfloatRRt comment_urlt_resttkeystsorttstrRR(tcookiethRtk((sBe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\_LWPCookieJar.pytlwp_cookie_strs8         
2014-07-09 18:15:23 +08:00
 $t LWPCookieJarcBs8eZdZeed<00>Zdeed<00>Zd<00>ZRS(sZ
The LWPCookieJar saves a sequence of "Set-Cookie3" lines.
"Set-Cookie3" is the format used by the libwww-perl libary, not known
to be compatible with any browser, but which is easy to read and
doesn't lose information about RFC 2965 cookies.
Additional methods
as_lwp_str(ignore_discard=True, ignore_expired=True)
2014-07-10 23:57:08 +08:00
cCs<>tj<00>}g}xW|D]O}| r5|jr5qn| rQ|j|<00>rQqn|jdt|<00><16>qWdj|dg<17>S(s<>Return cookies as a string of "\n"-separated "Set-Cookie3" headers.
2014-07-09 18:15:23 +08:00
ignore_discard and ignore_expires: see docstring for FileCookieJar.save
sSet-Cookie3: %ss
t(ttimeRt
2014-07-10 23:57:08 +08:00
is_expiredRR%tjoin(tselftignore_discardtignore_expirestnowtrR"((sBe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\_LWPCookieJar.pyt
2014-07-09 18:15:23 +08:00
as_lwp_str>s  cCs<>|dkr6|jdk r'|j}q6tt<00><00>nt|d<00>}z*|jd<00>|j|j||<00><00>Wd|j<00>XdS(Ntws#LWP-Cookies-2.0
(Rtfilenamet
2014-07-10 23:57:08 +08:00
ValueErrorRtopentwriteR0tclose(R+R2R,R-tf((sBe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\_LWPCookieJar.pytsaveNs   cCs
2014-07-09 18:15:23 +08:00
|j<00>}tj|j|<00>s:d|}t|<00><00>ntj<00>}d}d} d}
yjxc|j<00>} | dkrzPn| j|<00>s<>q^n| t|<00>j<00>} xt | g<00>D]} | d\} }i}i}x| D]}t
||<q<>Wx<57>| dD]<5D>\}}|dk r$|j <00>}nd}||
ksB|| krK|}n|| kry|dkrlt }n|||<q<>||
kr<>|||<q<>|||<q<>W|j}|d <00>}|d<00>}|dk r<>t|<00>}n|dkr<>t }n|d <00>}|jd<00>}t|d<00>| ||d <00>|d<00>|||d<00>|d
<00>|d<00>|d<00>|||d <00>|d<00>|<00>}| r<>|jr<>q<>n| r<>|j|<00>r<>q<>n|j|<00>q<>Wq^WnAtk
r<><01>n.tk
rt<00>td|| f<16><00>nXdS(Ns5%r does not look like a Set-Cookie3 (LWP) format files Set-Cookie3:R R RRRRR R R
RRRR'iit.s&invalid Set-Cookie3 format file %r: %r(s port_specs path_specs
domain_dotssecuresdiscard(sversionsportspathsdomainsexpiresscomments
commenturl(treadlinetretsearchtmagic_reRR(t
startswithtlentstripRtFalseRtlowertTruetgetRRRR)t
set_cookietIOErrort ExceptionR(R+R7R2R,R-tmagictmsgR.theadert boolean_attrst value_attrstlinetdataRRtstandardtrestR$tvtlcR#RRR
2014-07-10 23:57:08 +08:00
tdomain_specifiedtc((sBe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\_LWPCookieJar.pyt _really_load]s<>                         N( t__name__t
__module__t__doc__RCR0RRAR8RU(((sBe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\_LWPCookieJar.pyR&1s (RXR(R;t cookielibRRRRRRRRRR%R&(((sBe:\github\Wox.JSONRPC\Output\Debug\PythonHome\lib\_LWPCookieJar.pyt<module> s@