Your IP : 18.219.44.171
Current Path : /usr/lib64/python2.7/ |
|
Current File : //usr/lib64/python2.7/_MozillaCookieJar.pyc |
�
zfc @ s` d Z d d l Z d d l Z d d l m Z m Z m Z m Z m Z d e f d � � YZ d S( s+ Mozilla / Netscape cookie loading / saving.i����N( t _warn_unhandled_exceptiont
FileCookieJart LoadErrort Cookiet MISSING_FILENAME_TEXTt MozillaCookieJarc B s5 e Z d Z d Z d Z d � Z d e e d � Z RS( s�
WARNING: you may want to backup your browser's cookies file if you use
this class to save cookies. I *think* it works, but there have been
bugs in the past!
This class differs from CookieJar only in the format it uses to save and
load cookies to and from a file. This class uses the Mozilla/Netscape
`cookies.txt' format. lynx uses this file format, too.
Don't expect cookies saved while the browser is running to be noticed by
the browser (in fact, Mozilla on unix will overwrite your saved cookies if
you change them on disk while it's running; on Windows, you probably can't
save at all while the browser is running).
Note that the Mozilla/Netscape format will downgrade RFC2965 cookies to
Netscape cookies on saving.
In particular, the cookie version and port number information is lost,
together with information about whether or not Path, Port and Discard were
specified by the Set-Cookie2 (or Set-Cookie) header, and whether or not the
domain as set in the HTTP header started with a dot (yes, I'm aware some
domains in Netscape files start with a dot and some don't -- trust me, you
really don't want to know any more about this).
Note that though Mozilla and Netscape use the same format, they use
slightly different headers. The class saves cookies using the Netscape
header by default (Mozilla can cope with that).
s #( Netscape)? HTTP Cookie Filesr # Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file! Do not edit.
c C s t j � } | j � } t j | j | � sJ | j � t d | � � n y�xz| j � } | d k rl Pn | j d � r� | d } n | j � j d � sP | j � d k r� qP n | j
d � \ } } }
} } }
} | d k } | d k } |
d k r| }
d } n | j d � } | | k s-t � t
} | d k rNd } t } n t d
|
| d t
| | | |
t
| | | d d i � } | r�| j r�qP n | r�| j | � r�qP n | j | � qP WWnA t k
r�� n. t k
rt � t d | | f � � n Xd S(
Ns4 %r does not look like a Netscape format cookies filet s
i����t #t $s t TRUEt .i s+ invalid Netscape format cookies file %r: %r( R R ( t timet readlinet ret searcht magic_ret closeR t endswitht stript
startswitht splitt Nonet AssertionErrort Falset TrueR t discardt
is_expiredt
set_cookiet IOErrort ExceptionR ( t selft ft filenamet ignore_discardt ignore_expirest nowt magict linet domaint domain_specifiedt patht securet expirest namet valuet initial_dotR t c( ( s) /usr/lib64/python2.7/_MozillaCookieJar.pyt _really_load/ sd
$
c
C s� | d k r6 | j d k r'