ó zfc@sdZddlZddlZddlmZmZmZmZmZm Z m Z m Z m Z d„Z defd„ƒ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ÿÿÿÿN( t_warn_unhandled_exceptiont FileCookieJart LoadErrortCookietMISSING_FILENAME_TEXTtjoin_header_wordstsplit_header_wordstiso2timet time2isozcCs·|j|jfd|jfd|jfg}|jd k rU|jd|jfƒn|jrn|jdƒn|jr‡|jdƒn|j r |jdƒn|j r¹|jdƒn|j rç|jdt t |j ƒƒfƒn|jr|jdƒn|jr"|jd |jfƒn|jrD|jd |jfƒn|jjƒ}|jƒx.|D]&}|j|t|j|ƒfƒqdW|jd t|jƒfƒt|gƒS(sReturn string representation of Cookie in 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(RN(RN(tnametvalueR R R tNonetappendtpath_specifiedtport_specifiedtdomain_initial_dotRRRtfloatRRt comment_urlt_resttkeystsorttstrRR(tcookiethRtk((s%/usr/lib64/python2.7/_LWPCookieJar.pytlwp_cookie_strs8           $t LWPCookieJarcBs8eZdZeed„Zdeed„Zd„ZRS(s[ The LWPCookieJar saves a sequence of "Set-Cookie3" lines. "Set-Cookie3" is the format used by the libwww-perl library, 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) cCs€tjƒ}g}xW|D]O}| r5|jr5qn| rQ|j|ƒrQqn|jdt|ƒƒqWdj|dgƒS(sžReturn cookies as a string of "\n"-separated "Set-Cookie3" headers. ignore_discard and ignore_expires: see docstring for FileCookieJar.save sSet-Cookie3: %ss t(ttimeRt is_expiredRR%tjoin(tselftignore_discardtignore_expirestnowtrR"((s%/usr/lib64/python2.7/_LWPCookieJar.pyt as_lwp_str>s  cCs|dkr6|jdk r'|j}q6ttƒ‚nt|dƒ}z*|jdƒ|j|j||ƒƒWd|jƒXdS(Ntws#LWP-Cookies-2.0 (Rtfilenamet ValueErrorRtopentwriteR0tclose(R+R2R,R-tf((s%/usr/lib64/python2.7/_LWPCookieJar.pytsaveNs   cCs |jƒ}tj|j|ƒs:d|}t|ƒ‚ntjƒ}d}d} d} ykxd|jƒ} | dkrzPn| j|ƒsq^n| t|ƒjƒ} xt | gƒD]} | d\} }i}i}x| D]}t || s@