ok

Mini Shell

Direktori : /proc/self/root/usr/lib64/python2.7/
Upload File :
Current File : //proc/self/root/usr/lib64/python2.7/_LWPCookieJar.pyc

�
\цdc@s�dZddlZddlZddlmZmZmZmZmZm	Z	m
Z
mZm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|jr�|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(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
RtNonetappendtpath_specifiedtport_specifiedtdomain_initial_dotRRRtfloatRRtcomment_urlt_resttkeystsorttstrRR(tcookiethRtk((s%/usr/lib64/python2.7/_LWPCookieJar.pytlwp_cookie_strs8									

$tLWPCookieJarcBs8eZdZeed�Zdeed�Zd�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)

    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}
yjxc|j�}|dkrzPn|j|�s�q^n|t|�j�}xt	|g�D]}|d\}
}i}i}x|	D]}t
||<q�Wx�|dD]�\}}|dk	r$|j�}nd}||
ksB||	krK|}n||	kry|dkrlt
}n|||<q�||
kr�|||<q�|||<q�W|j}|d�}|d�}|dk	r�t|�}n|dkr�t
}n|d�}|jd�}t|d�|
||d	�|d�|||d�|d
�|d�|d�|||d
�|d�|�}|r�|jr�q�n|r�|j|�r�q�n|j|�q�Wq^WnAtk
r��n.tk
rt�td||f��nXdS(Ns5%r does not look like a Set-Cookie3 (LWP) format filesSet-Cookie3:R
RRRRRRR	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_attrstvalue_attrstlinetdataRRtstandardtrestR$tvtlcR#RRR
tdomain_specifiedtc((s%/usr/lib64/python2.7/_LWPCookieJar.pyt_really_load]s�
		

						

N(	t__name__t
__module__t__doc__RCR0RRAR8RU(((s%/usr/lib64/python2.7/_LWPCookieJar.pyR&1s(RXR(R;t	cookielibRRRRRRRRRR%R&(((s%/usr/lib64/python2.7/_LWPCookieJar.pyt<module>s@	

Zerion Mini Shell 1.0