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KO}ӽmSşذqsOy?\[,d@'73'j%kOe`1.g2"e =YIzS2|zŐƄa\U,dP;jhhhaxǶ?КZ՚.q SE+XrbOu%\GتX(H,N^~]JyEZQKceTQ]VGYqnah;y$cQahT&QPZ*iZ8UQQM.qo/T\7X"u?Mttl2Xq(IoW{R^ ux*SYJ! 4S.Jy~ BROS[V|žKNɛP(L6V^|cR7i7nZW1Fd@ Ara{詑|(T*dN]Ko?s=@ |_EvF]׍kR)eBJc" MUUbY6`~V޴dJKß&~'d3i WWWWWW
Current Directory: /usr/lib64/python3.6/http/__pycache__
Viewing File: /usr/lib64/python3.6/http/__pycache__/cookiejar.cpython-36.pyc
3 air+�@s*dZddddddddgZd d lZd d lZd d lZd d lZd d lZd d lZy d d l Z Wne k rpd d l Z YnXd d l Zd d lmZd Zd ad d�Zeejj�ZdZdd�ZdZdd�ZdddddddgZddddd d!d"d#d$d%d&d'g ZgZxeD]Zej ej!��q�Wdud(d)�Z"dvd*d+�Z#d d d d d,�Z$ej%d-ej&�Z'd.d/�Z(d0d1�Z)ej%d2ej&�Z*ej%d3ej+ej&B�Z,ej%d4ej-ej&B�Z.d5d6�Z/ej%d7ej-ej&B�Z0d8d9�Z1d:d;�Z2ej%d<�Z3ej%d=�Z4ej%d>�Z5ej%d?�Z6d@dA�Z7ej%dB�Z8dCdD�Z9dEdF�Z:dGdH�Z;ej%dIej&�Z<dJdK�Z=dLdM�Z>dNdO�Z?dPdQ�Z@ej%dRej&�ZAdSdT�ZBdUdV�ZCdWdX�ZDdYdZ�ZEd[ZFej%d\�ZGd]d^�ZHd_d`�ZIdadb�ZJdcdd�ZKGded�d�ZLGdfd�d�ZMGdgd�deM�ZNdhdi�ZOdjdk�ZPGdldm�dm�ZQGdnd�d�ZRGdod�deS�ZTGdpd�deR�ZUdqdr�ZVGdsd�deU�ZWGdtd�deU�ZXd S)wa�HTTP cookie handling for web clients. This module has (now fairly distant) origins in Gisle Aas' Perl module HTTP::Cookies, from the libwww-perl library. Docstrings, comments and debug strings in this code refer to the attributes of the HTTP cookie system as cookie-attributes, to distinguish them clearly from Python attributes. Class diagram (note that BSDDBCookieJar and the MSIE* classes are not distributed with the Python standard library, but are available from http://wwwsearch.sf.net/): CookieJar____ / \ \ FileCookieJar \ \ / | \ \ \ MozillaCookieJar | LWPCookieJar \ \ | | \ | ---MSIEBase | \ | / | | \ | / MSIEDBCookieJar BSDDBCookieJar |/ MSIECookieJar �Cookie� CookieJar� CookiePolicy�DefaultCookiePolicy� FileCookieJar� LWPCookieJar� LoadError�MozillaCookieJar�N)�timegmFcGs(tsdStsddl}|jd�atj|�S)Nr zhttp.cookiejar)�debug�logger�loggingZ getLogger)�argsr �r�!/usr/lib64/python3.6/cookiejar.py�_debug.s  rzQa filename was not supplied (nor was the CookieJar instance initialised with one)cCsJddl}ddl}ddl}|j�}|jd|�|j�}|jd|dd�dS)Nr zhttp.cookiejar bug! %s�)� stacklevel)�io�warnings� traceback�StringIO� print_exc�getvalue�warn)rrr�f�msgrrr�_warn_unhandled_exception<s  ri�cCs�|dd�\}}}}}}|tkr�d|ko2dknr�d|koJdknr�d|kobdknr�d|kozdknr�d|ko�dknr�t|�SdSdS) N��� �r ��;�=)� EPOCH_YEARr )�tt�year�monthZmday�hour�min�secrrr�_timegmKs 8Hr,ZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDeccCs@|dkrtjj�}n tjj|�}d|j|j|j|j|j|jfS)aHReturn a string representing time in seconds since epoch, t. If the function is called without an argument, it will use the current time. The format of the returned string is like "YYYY-MM-DD hh:mm:ssZ", representing Universal Time (UTC, aka GMT). An example of this format is: 1994-11-24 08:49:37Z Nz%04d-%02d-%02d %02d:%02d:%02dZ) �datetime�utcnow�utcfromtimestampr'r(�dayr)�minute�second)�t�dtrrr� time2isozYs   r5cCsR|dkrtjj�}n tjj|�}dt|j�|jt|jd|j|j |j |j fS)z�Return a string representing time in seconds since epoch, t. If the function is called without an argument, it will use the current time. The format of the returned string is like this: Wed, DD-Mon-YYYY HH:MM:SS GMT Nz#%s, %02d-%s-%04d %02d:%02d:%02d GMTr) r-r.r/�DAYSZweekdayr0�MONTHSr(r'r)r1r2)r3r4rrr� time2netscapels   r8)ZGMT�UTCZUT�Zz^([-+])?(\d\d?):?(\d\d)?$cCsjd}|tkrd}nTtj|�}|rfdt|jd��}|jd�rR|dt|jd��}|jd�dkrf| }|S)Nr ir��<r�-)� UTC_ZONES� TIMEZONE_RE�search�int�group)�tz�offset�mrrr�offset_from_tz_string�s  rFc Cs�t|�}|tjkrdSytj|j��d}WnXtk r�y t|�}Wntk r\dSXd|kopdknr||}ndSYnX|dkr�d}|dkr�d}|dkr�d}t|�}t|�}t|�}t|�}|dk�r0tjtj��d}|d} |} ||| }| | } t | �dk�r0| dk�r(|d}n|d}t |||||||f�} | dk �r�|dk�r^d}|j �}t |�} | dk�r|dS| | } | S)Nrr r i��d�2r9) rAr-ZMAXYEAR� MONTHS_LOWER�index�lower� ValueError�timeZ localtime�absr,�upperrF) r0�mon�yr�hrr*r+rCZimonZcur_yrrEZtmpr3rDrrr� _str2time�sV         rSzV^[SMTWF][a-z][a-z], (\d\d) ([JFMASOND][a-z][a-z]) (\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$z+^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)[a-z]*,?\s*a�^ (\d\d?) # day (?:\s+|[-\/]) (\w+) # month (?:\s+|[-\/]) (\d+) # year (?: (?:\s+|:) # separator before clock (\d\d?):(\d\d) # hour:min (?::(\d\d))? # optional seconds )? # optional clock \s* ([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+)? # timezone \s* (?:\(\w+\))? # ASCII representation of timezone in parens. \s*$c Cs�tj|�}|rl|j�}tj|dj��d}t|d�|t|d�t|d�t|d�t|d�f}t|�S|j �}t j d|d�}dgd \}}}}}} } t j|�}|dk r�|j�\}}}}}} } ndSt |||||| | �S) a�Returns time in seconds since epoch of time represented by a string. Return value is an integer. None is returned if the format of str is unrecognized, the time is outside the representable range, or the timezone string is not recognized. If the string contains no timezone, UTC is assumed. The timezone in the string may be numerical (like "-0800" or "+0100") or a string timezone (like "UTC", "GMT", "BST" or "EST"). Currently, only the timezone strings equivalent to UTC (zero offset) are known to the function. The function loosely parses the following formats: Wed, 09 Feb 1994 22:23:32 GMT -- HTTP format Tuesday, 08-Feb-94 14:15:29 GMT -- old rfc850 HTTP format Tuesday, 08-Feb-1994 14:15:29 GMT -- broken rfc850 HTTP format 09 Feb 1994 22:23:32 GMT -- HTTP format (no weekday) 08-Feb-94 14:15:29 GMT -- rfc850 format (no weekday) 08-Feb-1994 14:15:29 GMT -- broken rfc850 format (no weekday) The parser ignores leading and trailing whitespace. The time may be absent. If the year is given with only 2 digits, the function will select the century that makes the year closest to the current date. rrr r;���N�)�STRICT_DATE_REr@�groupsrIrJrKrA�floatr,�lstrip� WEEKDAY_RE�sub�LOOSE_HTTP_DATE_RErS) �textrE�grPr&r0rQrRr*r+rCrrr� http2time�s " raa�^ (\d{4}) # year [-\/]? (\d\d?) # numerical month [-\/]? (\d\d?) # day (?: (?:\s+|[-:Tt]) # separator before clock (\d\d?):?(\d\d) # hour:min (?::?(\d\d(?:\.\d*)?))? # optional seconds (and fractional) )? # optional clock \s* ([-+]?\d\d?:?(:?\d\d)? |Z|z)? # timezone (Z is "zero meridian", i.e. GMT) \s*$c Csd|j�}dgd\}}}}}}}tj|�}|dk rL|j�\}}}}}}}} ndSt|||||||�S)av As for http2time, but parses the ISO 8601 formats: 1994-02-03 14:15:29 -0100 -- ISO 8601 format 1994-02-03 14:15:29 -- zone is optional 1994-02-03 -- only date 1994-02-03T14:15:29 -- Use T as separator 19940203T141529Z -- ISO 8601 compact format 19940203 -- only date NrW)r[� ISO_DATE_REr@rYrS) r_r0rPrQrRr*r+rCrE�_rrr�iso2time's  rdcCs*|jd�\}}|jd|�|j|d�S)z)Return unmatched part of re.Match object.r N)�span�string)�match�start�endrrr� unmatchedHsrjz^\s*([^=\s;,]+)z&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"z^\s*=\s*([^\s;,]*)z\\(.)c Cs<t|t� st�g}�x |D�]}|}g}x�|�r$tj|�}|r�t|�}|jd�}tj|�}|r�t|�}|jd�}tj d|�}n.t j|�}|r�t|�}|jd�}|j �}nd}|j ||f�q,|j �jd�r�|j �dd�}|r�|j |�g}q,tjdd|�\}} | dk�std|||f��|}q,W|r|j |�qW|S) amParse header values into a list of lists containing key,value pairs. The function knows how to deal with ",", ";" and "=" as well as quoted values after "=". A list of space separated tokens are parsed as if they were separated by ";". If the header_values passed as argument contains multiple values, then they are treated as if they were a single value separated by comma ",". This means that this function is useful for parsing header fields that follow this syntax (BNF as from the HTTP/1.1 specification, but we relax the requirement for tokens). headers = #header header = (token | parameter) *( [";"] (token | parameter)) token = 1*<any CHAR except CTLs or separators> separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) qdtext = <any TEXT except <">> quoted-pair = "\" CHAR parameter = attribute "=" value attribute = token value = token | quoted-string Each header is represented by a list of key/value pairs. The value for a simple token (not part of a parameter) is None. Syntactically incorrect headers will not necessarily be parsed as you would want. This is easier to describe with some examples: >>> split_header_words(['foo="bar"; port="80,81"; discard, bar=baz']) [[('foo', 'bar'), ('port', '80,81'), ('discard', None)], [('bar', 'baz')]] >>> split_header_words(['text/html; charset="iso-8859-1"']) [[('text/html', None), ('charset', 'iso-8859-1')]] >>> split_header_words([r'Basic realm="\"foo\bar\""']) [[('Basic', None), ('realm', '"foobar"')]] rz\1N�,z^[=\s;]*rVr z&split_header_words bug: '%s', '%s', %s)� isinstance�str�AssertionError�HEADER_TOKEN_REr@rjrB�HEADER_QUOTED_VALUE_RE�HEADER_ESCAPE_REr]�HEADER_VALUE_RE�rstrip�appendr[� startswith�re�subn) Z header_values�resultr_Z orig_text�pairsrE�name�valueZnon_junkZ nr_junk_charsrrr�split_header_wordsQsF-         r|z([\"\\])cCs�g}xt|D]l}g}xN|D]F\}}|dk rTtjd|�sHtjd|�}d|}d||f}|j|�qW|r |jdj|��q Wdj|�S)a�Do the inverse (almost) of the conversion done by split_header_words. Takes a list of lists of (key, value) pairs and produces a single header value. Attribute values are quoted if needed. >>> join_header_words([[("text/plain", None), ("charset", "iso-8859-1")]]) 'text/plain; charset="iso-8859-1"' >>> join_header_words([[("text/plain", None)], [("charset", "iso-8859-1")]]) 'text/plain, charset="iso-8859-1"' Nz^\w+$z\\\1z"%s"z%s=%sz; z, )rvr@�HEADER_JOIN_ESCAPE_REr]rt�join)Zlists�headersry�attr�k�vrrr�join_header_words�s     r�cCs0|jd�r|dd�}|jd�r,|dd�}|S)N�"r���)ru�endswith)r_rrr� strip_quotes�s     r�c Csd}g}x�|D]�}g}d}x�t|jd ��D]�\}}|j�}|jd �\}} } |j�}|sd|d kr*Pnq*| rp| j�nd } |d kr�|j�} | |kr�| }|dkr�| d k r�t| �} d }n|dkr�| d k r�tt| ��} |j|| f�q*W|r|�s�|jd�|j|�qW|S)a5Ad-hoc parser for Netscape protocol cookie-attributes. The old Netscape cookie format for Set-Cookie can for instance contain an unquoted "," in the expires field, so we have to use this ad-hoc parser instead of split_header_words. XXX This may not make the best possible effort to parse all the crap that Netscape Cookie headers contain. Ronald Tschalar's HTTPClient parser is probably better, so could do worse than following that if this ever gives any trouble. Currently, this is also used for parsing RFC 2109 cookies. �expires�domain�path�secure�version�port�max-ageF�;�=r NT�0)r�r�r�r�r�r�r�)r�r�)� enumerate�split�strip� partitionrKr�rart) Z ns_headersZ known_attrsrxZ ns_headerry� version_setZiiZparam�key�sep�val�lcrrr�parse_ns_headers�s@   r�z\.\d+$cCs:tj|�rdS|dkrdS|ddks2|ddkr6dSdS)z*Return True if text is a host domain name.FrVr �.rTr�)�IPV4_REr@)r_rrr�is_HDN s r�cCsl|j�}|j�}||krdSt|�s(dS|j|�}|dksB|dkrFdS|jd�sTdSt|dd��shdSdS)a�Return True if domain A domain-matches domain B, according to RFC 2965. A and B may be host domain names or IP addresses. RFC 2965, section 1: Host names can be specified either as an IP address or a HDN string. Sometimes we compare one host name with another. (Such comparisons SHALL be case-insensitive.) Host A's name domain-matches host B's if * their host name strings string-compare equal; or * A is a HDN string and has the form NB, where N is a non-empty name string, B has the form .B', and B' is a HDN string. (So, x.y.com domain-matches .Y.com but not Y.com.) Note that domain-match is not a commutative operation: a.b.c.com domain-matches .c.com, but not the reverse. TFrr r�Nr�)rKr��rfindru)�A�B�irrr� domain_matchs  r�cCstj|�rdSdS)zdReturn True if text is a sort-of-like a host domain name. For accepting/blocking domains. FT)r�r@)r_rrr�liberal_is_HDNBs r�cCsb|j�}|j�}t|�ot|�s0||kr,dSdS|jd�}|rL|j|�rLdS| r^||kr^dSdS)z\For blocking/accepting domains. A and B may be host domain names or IP addresses. TFr�)rKr�rur�)r�r�� initial_dotrrr�user_domain_matchLs r�z:\d+$cCsB|j�}tjj|�d}|dkr,|jdd�}tjd|d�}|j�S)z�Return request-host, as defined by RFC 2965. Variation from RFC: returned value is lowercased, for convenient comparison. rrVZHost)� get_full_url�urllib�parseZurlparseZ get_header� cut_port_rer]rK)�request�url�hostrrr� request_hostas  r�cCs6t|�}}|jd�dkr.tj|� r.|d}||fS)zzReturn a tuple (request-host, effective request-host name). As defined by RFC 2965, except both are lowercased. r�rz.localr�)r��findr�r@)r��erhn�req_hostrrr�eff_request_hostqs r�cCs4|j�}tjj|�}t|j�}|jd�s0d|}|S)z6Path component of request-URI, as defined by RFC 2965.�/)r�r�r�Zurlsplit� escape_pathr�ru)r�r��partsr�rrr� request_path|s    r�c Cs^|j}|jd�}|dkrV||dd�}y t|�WqZtk rRtd|�dSXnt}|S)N�:r rznonnumeric port: '%s')r�r�rArLr�DEFAULT_HTTP_PORT)r�r�r�r�rrr� request_port�s   r�z%/;:@&=+$,!~*'()z%([0-9a-fA-F][0-9a-fA-F])cCsd|jd�j�S)Nz%%%sr)rBrO)rgrrr�uppercase_escaped_char�sr�cCstjj|t�}tjt|�}|S)zEEscape any invalid characters in HTTP URL, and uppercase all escapes.)r�r�Zquote�HTTP_PATH_SAFE�ESCAPED_CHAR_REr]r�)r�rrrr��s  r�cCsP|jd�}|dkrL||dd�}|jd�}t|�rL|dksD|dkrLd|S|S)aBReturn reach of host h, as defined by RFC 2965, section 1. The reach R of a host name H is defined as follows: * If - H is the host domain name of a host; and, - H has the form A.B; and - A has no embedded (that is, interior) dots; and - B has at least one embedded dot, or B is the string "local". then the reach of H is .B. * Otherwise, the reach of H is H. >>> reach("www.acme.com") '.acme.com' >>> reach("acme.com") 'acme.com' >>> reach("acme.local") '.local' r�r rNZlocal)r�r�)�hr��brrr�reach�s  r�cCs$t|�}t|t|j��sdSdSdS)z� RFC 2965, section 3.3.6: An unverifiable transaction is to a third-party host if its request- host U does not domain-match the reach R of the request-host O in the origin transaction. TFN)r�r�r�Zorigin_req_host)r�r�rrr�is_third_party�s r�c@sNeZdZdZddd�Zdd�Zddd �Zd d �Zdd d �Zdd�Z dd�Z dS)ra�HTTP Cookie. This class represents both Netscape and RFC 2965 cookies. This is deliberately a very simple class. It just holds attributes. It's possible to construct Cookie instances that don't comply with the cookie standards. CookieJar.make_cookies is the factory function for Cookie objects -- it deals with cookie parsing, supplying defaults, and normalising to the representation used in this class. CookiePolicy is responsible for checking them to see whether they should be accepted from and returned to the server. Note that the port may be present in the headers, but unspecified ("Port" rather than"Port=80", for example); if this is the case, port is None. FcCs�|dk rt|�}| dk r$tt| ��} |dkr<|dkr<td��||_||_||_||_||_|j�|_ ||_ ||_ | |_ | |_ | |_| |_| |_||_||_||_tj|�|_dS)NTz-if port is None, port_specified must be false)rArZrLr�rzr{r��port_specifiedrKr��domain_specified�domain_initial_dotr��path_specifiedr�r��discard�comment� comment_url�rfc2109�copy�_rest)�selfr�rzr{r�r�r�r�r�r�r�r�r�r�r�r��restr�rrr�__init__�s.   zCookie.__init__cCs ||jkS)N)r�)r�rzrrr�has_nonstandard_attrszCookie.has_nonstandard_attrNcCs|jj||�S)N)r��get)r�rz�defaultrrr�get_nonstandard_attrszCookie.get_nonstandard_attrcCs||j|<dS)N)r�)r�rzr{rrr�set_nonstandard_attrszCookie.set_nonstandard_attrcCs,|dkrtj�}|jdk r(|j|kr(dSdS)NTF)rMr�)r��nowrrr� is_expireds zCookie.is_expiredcCsX|jdkrd}n d|j}|j||j}|jdk rFd|j|jf}n|j}d||fS)NrVr�z%s=%sz<Cookie %s for %s>)r�r�r�r{rz)r��p�limitZ namevaluerrr�__str__%s   zCookie.__str__cCspg}x,dD]$}t||�}|jd|t|�f�q W|jdt|j��|jdt|j��d|jjdj|�fS)Nr�rzr{r�r�r�r�r�r�r�r�r�r�r�r�z%s=%szrest=%sz rfc2109=%sz%s(%s)z, )r�rzr{r�r�r�r�r�r�r�r�r�r�r�r�)�getattrrt�reprr�r�� __class__�__name__r~)r�rrzr�rrr�__repr__/s zCookie.__repr__)F)N)N) r�� __module__� __qualname__�__doc__r�r�r�r�r�r�r�rrrrr�s    c@s0eZdZdZdd�Zdd�Zdd�Zdd �Zd S) ra Defines which cookies get accepted from and returned to server. May also modify cookies, though this is probably a bad idea. The subclass DefaultCookiePolicy defines the standard rules for Netscape and RFC 2965 cookies -- override that if you want a customized policy. cCs t��dS)z�Return true if (and only if) cookie should be accepted from server. Currently, pre-expired cookies never get this far -- the CookieJar class deletes such cookies itself. N)�NotImplementedError)r��cookier�rrr�set_okGszCookiePolicy.set_okcCs t��dS)zAReturn true if (and only if) cookie should be returned to server.N)r�)r�r�r�rrr� return_okPszCookiePolicy.return_okcCsdS)zMReturn false if cookies should not be returned, given cookie domain. Tr)r�r�r�rrr�domain_return_okTszCookiePolicy.domain_return_okcCsdS)zKReturn false if cookies should not be returned, given cookie path. Tr)r�r�r�rrr�path_return_okYszCookiePolicy.path_return_okN)r�r�r�r�r�r�r�r�rrrrr>s  c @s�eZdZdZdZdZdZdZeeBZdddddddddeddf d d �Z d d �Z d d�Z dd�Z dd�Z dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�ZdS)7rzBImplements the standard rules for accepting and returning cookies.rrrTr NTFc Csp||_||_||_||_||_||_| |_| |_| |_| |_ |dk rPt |�|_ nf|_ |dk rft |�}||_ dS)zAConstructor arguments should be passed as keyword arguments only.N) �netscape�rfc2965�rfc2109_as_netscape� hide_cookie2� strict_domain�strict_rfc2965_unverifiable�strict_ns_unverifiable�strict_ns_domain�strict_ns_set_initial_dollar�strict_ns_set_path�tuple�_blocked_domains�_allowed_domains) r��blocked_domains�allowed_domainsr�r�r�r�r�r�r�r�r�r�rrrr�is  zDefaultCookiePolicy.__init__cCs|jS)z4Return the sequence of blocked domains (as a tuple).)r�)r�rrrr��sz#DefaultCookiePolicy.blocked_domainscCst|�|_dS)z$Set the sequence of blocked domains.N)r�r�)r�r�rrr�set_blocked_domains�sz'DefaultCookiePolicy.set_blocked_domainscCs"x|jD]}t||�rdSqWdS)NTF)r�r�)r�r�Zblocked_domainrrr� is_blocked�s  zDefaultCookiePolicy.is_blockedcCs|jS)z=Return None, or the sequence of allowed domains (as a tuple).)r�)r�rrrr��sz#DefaultCookiePolicy.allowed_domainscCs|dk rt|�}||_dS)z-Set the sequence of allowed domains, or None.N)r�r�)r�r�rrr�set_allowed_domains�sz'DefaultCookiePolicy.set_allowed_domainscCs0|jdkrdSx|jD]}t||�rdSqWdS)NFT)r�r�)r�r�Zallowed_domainrrr�is_not_allowed�s    z"DefaultCookiePolicy.is_not_allowedcCsPtd|j|j�|jdk st�x,d D]$}d |}t||�}|||�s$d Sq$Wd S) z� If you override .set_ok(), be sure to call this method. If it returns false, so should your subclass (assuming your subclass wants to be more strict about which cookies to accept). z - checking cookie %s=%sNr�� verifiabilityrzr�r�r�Zset_ok_FT)r�r�rzr�r�r�)rrzr{rnr�)r�r�r��n�fn_name�fnrrrr��s   zDefaultCookiePolicy.set_okcCs^|jdkrtd|j|j�dS|jdkr<|j r<td�dS|jdkrZ|j rZtd�dSdS)Nz0 Set-Cookie2 without version attribute (%s=%s)Fr z$ RFC 2965 cookies are switched offz$ Netscape cookies are switched offT)r�rrzr{r�r�)r�r�r�rrr�set_ok_version�s  z"DefaultCookiePolicy.set_ok_versioncCsJ|jrFt|�rF|jdkr*|jr*td�dS|jdkrF|jrFtd�dSdS)Nr z> third-party RFC 2965 cookie during unverifiable transactionFz> third-party Netscape cookie during unverifiable transactionT)� unverifiabler�r�r�rr�)r�r�r�rrr�set_ok_verifiability�sz(DefaultCookiePolicy.set_ok_verifiabilitycCs0|jdkr,|jr,|jjd�r,td|j�dSdS)Nr �$z' illegal name (starts with '$'): '%s'FT)r�r�rzrur)r�r�r�rrr� set_ok_name�s   zDefaultCookiePolicy.set_ok_namecCsL|jrHt|�}|jdks(|jdkrH|jrH|j|j� rHtd|j|�dSdS)Nr z7 path attribute %s is not a prefix of request path %sFT)r�r�r�r�rur�r)r�r�r��req_pathrrr� set_ok_path�s  zDefaultCookiePolicy.set_ok_pathc Cs�|j|j�rtd|j�dS|j|j�r8td|j�dS|j�r�t|�\}}|j}|jr�|jd�dkr�|jd�}|jdd|�}|dkr�||dd�}||d|�} | j �d$kr�t |�dkr�td|�dS|j d��r�|dd�} n|} | j d�dk} | �r|dk�rtd|�dS|j dk�rb|j|� �rb|j d� �rbd|j|� �rbtd ||�dS|j dk�s||j|j@�r�t||��s�td!||�dS|j dk�s�|j|j@�r�|dt |� �} | j d�dk�r�tj|� �r�td"| |�dSd#S)%Nz" domain %s is in user block-listFz& domain %s is not in user allow-listr�rr r�co�ac�com�edu�org�net�gov�milrA�aero�biz�cat�coop�info�jobs�mobi�museumrz�pro�travel�euz& country-code second level domain %sz.localz/ non-local domain %s contains no embedded dotzO effective request-host %s (even with added initial dot) does not end with %sz5 effective request-host %s does not domain-match %sz. host prefix %s for domain %s contains a dotT)rrrrrr r r rAr r rrrrrrrzrrr)r�r�rr�r�r�r��countr�rK�lenrur�r�r�r��DomainRFC2965Matchr��DomainStrictNoDotsr�r@) r�r�r�r�r�r�r��jZtldZsldZundotted_domainZ embedded_dotsZ host_prefixrrr� set_ok_domain�sf            z!DefaultCookiePolicy.set_ok_domainc Cs�|jr�t|�}|dkrd}nt|�}x\|jjd�D]:}y t|�Wntk r`td|�dSX||kr2Pq2Wtd||j�dSdS)N�80rkz bad port %s (not numeric)Fz$ request port (%s) not found in %sT)r�r�rmr�r�rArLr)r�r�r��req_portr�rrr� set_ok_port%s"   zDefaultCookiePolicy.set_ok_portcCsBtd|j|j�x,d D]$}d|}t||�}|||�sd SqWd S) z� If you override .return_ok(), be sure to call this method. If it returns false, so should your subclass (assuming your subclass wants to be more strict about which cookies to return). z - checking cookie %s=%sr�r�r�r�r�r�Z return_ok_FT)r�r�r�r�r�r�)rrzr{r�)r�r�r�r�r�r�rrrr�:s    zDefaultCookiePolicy.return_okcCs@|jdkr|j rtd�dS|jdkr<|j r<td�dSdS)Nr z$ RFC 2965 cookies are switched offFz$ Netscape cookies are switched offT)r�r�rr�)r�r�r�rrr�return_ok_versionLsz%DefaultCookiePolicy.return_ok_versioncCsJ|jrFt|�rF|jdkr*|jr*td�dS|jdkrF|jrFtd�dSdS)Nr z> third-party RFC 2965 cookie during unverifiable transactionFz> third-party Netscape cookie during unverifiable transactionT)r�r�r�r�rr�)r�r�r�rrr�return_ok_verifiabilityUsz+DefaultCookiePolicy.return_ok_verifiabilitycCs |jr|jdkrtd�dSdS)NZhttpsz( secure cookie with non-secure requestFT)r��typer)r�r�r�rrr�return_ok_secureasz$DefaultCookiePolicy.return_ok_securecCs|j|j�rtd�dSdS)Nz cookie expiredFT)r��_nowr)r�r�r�rrr�return_ok_expiresgs z%DefaultCookiePolicy.return_ok_expirescCsP|jrLt|�}|dkrd}x0|jjd�D]}||kr(Pq(Wtd||j�dSdS)Nrrkz0 request port %s does not match cookie port %sFT)r�r�r�r)r�r�r�rr�rrr�return_ok_portms z"DefaultCookiePolicy.return_ok_portcCs�t|�\}}|j}|r,|jd� r,d|}n|}|jdkrb|j|j@rb|j rb||krbtd�dS|jdkr�t||� r�td||�dS|jdkr�d|j |� r�td||�dSdS)Nr�r zQ cookie with unspecified domain does not string-compare equal to request domainFzQ effective request-host name %s does not domain-match RFC 2965 cookie domain %sz; request-host %s does not match Netscape cookie domain %sT) r�r�rur�r��DomainStrictNonDomainr�rr�r�)r�r�r�r�r�r�� dotdomainrrr�return_ok_domain{s&    z$DefaultCookiePolicy.return_ok_domaincCs�t|�\}}|jd�sd|}|jd�s0d|}|rJ|jd� rJd|}n|}|j|�p`|j|�sfdS|j|�r~td|�dS|j|�r�td|�dSdS)Nr�Fz" domain %s is in user block-listz& domain %s is not in user allow-listT)r�rur�r�rr�)r�r�r�r�r�r(rrrr��s"        z$DefaultCookiePolicy.domain_return_okcCs0td|�t|�}|j|�s,td||�dSdS)Nz- checking cookie path=%sz %s does not path-match %sFT)rr�ru)r�r�r�rrrrr��s    z"DefaultCookiePolicy.path_return_ok) r�r�r�r�rr'rZ DomainLiberalZ DomainStrictr�r�r�r�r�r�r�r�r�r�rrrrr�r r!r#r%r&r)r�r�rrrrr_sL    ;  cCst|j��}t|j|�S)N)�sorted�keys�mapr�)Zadictr+rrr�vals_sorted_by_key�s r-c csZt|�}xL|D]D}d}y |jWntk r4YnXd}t|�EdH|s|VqWdS)zBIterates over nested mapping, depth-first, in sorted order by key.FTN)r-�items�AttributeError� deepvalues)�mapping�values�objrrrr0�s  r0c@s eZdZdS)�AbsentN)r�r�r�rrrrr4�sr4c@s�eZdZdZejd�Zejd�Zejd�Zejd�Z ejd�Z ejdej �Z d3d d �Z d d �Zd d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd4d%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Z d1d2�Z!dS)5rz�Collection of HTTP cookies. You may not need to know about this class: try urllib.request.build_opener(HTTPCookieProcessor).open(url). z\Wz([\"\\])z\.?[^.]*z[^.]*z^\.+z^\#LWP-Cookies-(\d+\.\d+)NcCs(|dkrt�}||_tj�|_i|_dS)N)r�_policy� _threading�RLock� _cookies_lock�_cookies)r��policyrrrr��s  zCookieJar.__init__cCs ||_dS)N)r5)r�r:rrr� set_policy�szCookieJar.set_policycCs�g}|jj||�sgStd|�|j|}xd|j�D]X}|jj||�sHq4||}x:|j�D].}|jj||�svtd�qZtd�|j|�qZWq4W|S)Nz!Checking %s for cookies to returnz not returning cookiez it's a match) r5r�rr9r+r�r2r�rt)r�r�r��cookiesZcookies_by_pathr�Zcookies_by_namer�rrr�_cookies_for_domain�s   zCookieJar._cookies_for_domaincCs.g}x$|jj�D]}|j|j||��qW|S)z2Return a list of cookies to be returned to server.)r9r+�extendr=)r�r�r<r�rrr�_cookies_for_request�szCookieJar._cookies_for_requestc CsF|jdd�dd�d}g}�x$|D�]}|j}|sLd}|dkrL|jd|�|jdk r~|jj|j�r~|dkr~|jjd |j�}n|j}|jdkr�|j|j�n|jd |j|f�|dkr"|j r�|jd |j �|j j d ��r|j }|j o�|j d ��r|d d�}|jd|�|jdk r"d}|j�r4|d|j}|j|�q"W|S)z�Return a list of cookie-attributes to be returned to server. like ['foo="bar"; $Path="/"', ...] The $Version attribute is also added when appropriate (currently only once per request). cSs t|j�S)N)rr�)�arrr�<lambda>sz)CookieJar._cookie_attrs.<locals>.<lambda>T)r��reverseFr z $Version=%sNz\\\1z%s=%sz $Path="%s"r�rz $Domain="%s"z$Portz="%s")�sortr�rtr{� non_word_rer@�quote_rer]rzr�r�r�rur�r�r�) r�r<r��attrsr�r�r{r�r�rrr� _cookie_attrss>      zCookieJar._cookie_attrsc Cs�td�|jj�z�ttj��|j_|_|j|�}|j|�}|r^|j d�s^|j ddj |��|jj r�|jj r�|j d� r�x$|D]}|jdkr�|j dd�Pq�WWd|jj�X|j�dS)z�Add correct Cookie: header to request (urllib.request.Request object). The Cookie2 header is also added unless policy.hide_cookie2 is true. �add_cookie_headerrz; ZCookie2rz $Version="1"N)rr8�acquirerArMr5r$r?rGZ has_headerZadd_unredirected_headerr~r�r�r��release�clear_expired_cookies)r�r�r<rFr�rrrrH?s$          zCookieJar.add_cookie_headercCs�g}d}d}�x||D�]r}|d \}}d }d } i} i} �x4|d d�D�]"\} } | j�}||ksh||krl|} | |kr�| dkr�d} | | kr�qF| dkr�| dkr�td�d} P| j�} | dkr�|r�qF| dkr�td�qF| dk�rd}y t| �} Wn$tk �rtd�d} PYnXd} |j| } | |k�s2| |k�rb| dk�rX| dk�rXtd| �d} P| | | <qF| | | <qFW| �rvq|j||| | f�qW|S)aReturn list of tuples containing normalised cookie information. attrs_set is the list of lists of key,value pairs extracted from the Set-Cookie or Set-Cookie2 headers. Tuples are name, value, standard, rest, where name and value are the cookie name and value, standard is a dictionary containing the standard cookie-attributes (discard, secure, version, expires or max-age, domain, path and port) and rest is a dictionary containing the rest of the cookie-attributes. r�r�r�r��max-ager�r�r�r�� commenturlr FrNTz% missing value for domain attributezM missing or invalid value for expires attribute: treating as session cookiez? missing or invalid (non-numeric) value for max-age attributez! missing value for %s attribute)r�r�)r�r�rLr�r�r�r�rM)r�r�rM)rKrrArLr$rt)r�� attrs_set� cookie_tuples� boolean_attrs� value_attrsZ cookie_attrsrzr{Z max_age_setZ bad_cookie�standardr�r�r�r�rrr�_normalized_cookie_tuples`sl          z#CookieJar._normalized_cookie_tuplesc!Cs$|\}}}}|jdt�}|jdt�}|jdt�} |jdt�} |jdd�} | dk rry t| �} Wntk rpdSX|jdd�} |jdd�} |jd d�}|jd d�}|tk r�|d kr�d }t|�}nXd}t|�}|jd �}|dk�r| dkr�|d|�}n|d|d�}t|�dk�rd }|tk }d}|�r8t|j d��}|tk�rTt |�\}}|}n|j d��shd|}d}| tk �r�| dk�r�t |�} nd }t j dd | �} nd} | tk�r�d} d } nH| |jk�r�y|j|||�Wntk �r�YnXtd|||�dSt| ||| ||||||| | | |||�S)Nr�r�r�r�r�r�Fr�r�rMrVTr�rr r�z\s+z2Expiring cookie, domain='%s', path='%s', name='%s'r�)r�r4rArLr�r�r�r�boolrur�r�rvr]r$�clear�KeyErrorrr)r��tupr�rzr{rRr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr�_cookie_from_cookie_tuple�s�                       z#CookieJar._cookie_from_cookie_tuplecCs:|j|�}g}x&|D]}|j||�}|r|j|�qW|S)N)rSrXrt)r�rNr�rOr<rWr�rrr�_cookies_from_attrs_sets   z!CookieJar._cookies_from_attrs_setcCsLt|jdd�}|dkr |jj }x&|D]}|jdkr&d|_|r&d|_q&WdS)Nr�rTr )r�r5r�r�r�)r�r<Z rfc2109_as_nsr�rrr�_process_rfc2109_cookies&s   z"CookieJar._process_rfc2109_cookiesc Cs6|j�}|jdg�}|jdg�}|jj}|jj}| r<| s`| rH| s`| rT| s`| rd| rdgSy|jt|�|�}Wntk r�t�g}YnX|o�|�r2y|jt |�|�} Wntk r�t�g} YnX|j | �|�r"i} x |D]} d| | j | j | j f<q�W| fdd�} t| | �} | �r2|j| �|S)zAReturn sequence of Cookie objects extracted from response object.z Set-Cookie2z Set-CookieNcSs|j|j|jf}||kS)N)r�r�rz)Z ns_cookie�lookupr�rrr�no_matching_rfc2965^sz3CookieJar.make_cookies.<locals>.no_matching_rfc2965)rZget_allr5r�r�rYr|� Exceptionrr�rZr�r�rz�filterr>) r��responser�rZ rfc2965_hdrsZns_hdrsr�r�r<Z ns_cookiesr[r�r\rrr� make_cookies2sB              zCookieJar.make_cookiesc CsN|jj�z2ttj��|j_|_|jj||�r:|j|�Wd|jj�XdS)z-Set a cookie if policy says it's OK to do so.N) r8rIrArMr5r$r�� set_cookierJ)r�r�r�rrr�set_cookie_if_okhs  zCookieJar.set_cookie_if_okc Csl|j}|jj�zJ|j|kr&i||j<||j}|j|krDi||j<||j}|||j<Wd|jj�XdS)z?Set a cookie, without checking whether or not it should be set.N)r9r8rIr�r�rzrJ)r�r��cZc2Zc3rrrraus     zCookieJar.set_cookiec Cs|td|j��|jj�zRttj��|j_|_x6|j||�D]&}|jj ||�r>td|�|j |�q>WWd|jj �XdS)zAExtract cookies from response, where allowable given the request.zextract_cookies: %sz setting cookie: %sN) rrr8rIrArMr5r$r`r�rarJ)r�r_r�r�rrr�extract_cookies�s  zCookieJar.extract_cookiescCst|dk r2|dks|dkr td��|j|||=n>|dk rX|dkrJtd��|j||=n|dk rj|j|=ni|_dS)a�Clear some cookies. Invoking this method without arguments will clear all cookies. If given a single argument, only cookies belonging to that domain will be removed. If given two arguments, cookies belonging to the specified path within that domain are removed. If given three arguments, then the cookie with the specified name, path and domain is removed. Raises KeyError if no matching cookie exists. Nz8domain and path must be given to remove a cookie by namez.domain must be given to remove cookies by path)rLr9)r�r�r�rzrrrrU�s  zCookieJar.clearc CsH|jj�z,x&|D]}|jr|j|j|j|j�qWWd|jj�XdS)z�Discard all session cookies. Note that the .save() method won't save session cookies anyway, unless you ask otherwise by passing a true ignore_discard argument. N)r8rIr�rUr�r�rzrJ)r�r�rrr�clear_session_cookies�s   zCookieJar.clear_session_cookiesc CsT|jj�z8tj�}x*|D]"}|j|�r|j|j|j|j�qWWd|jj�XdS)a�Discard all expired cookies. You probably don't need to call this method: expired cookies are never sent back to the server (provided you're using DefaultCookiePolicy), this method is called by CookieJar itself every so often, and the .save() method won't save expired cookies anyway (unless you ask otherwise by passing a true ignore_expires argument). N) r8rIrMr�rUr�r�rzrJ)r�r�r�rrrrK�s   zCookieJar.clear_expired_cookiescCs t|j�S)N)r0r9)r�rrr�__iter__�szCookieJar.__iter__cCsd}x|D] }|d}q W|S)z#Return number of contained cookies.r rr)r�r�r�rrr�__len__�s zCookieJar.__len__cCs6g}x|D]}|jt|��q Wd|jjdj|�fS)Nz<%s[%s]>z, )rtr�r�r�r~)r��rr�rrrr��s zCookieJar.__repr__cCs6g}x|D]}|jt|��q Wd|jjdj|�fS)Nz<%s[%s]>z, )rtrmr�r�r~)r�rhr�rrrr��s zCookieJar.__str__)N)NNN)"r�r�r�r�rv�compilerDrEZstrict_domain_reZ domain_reZdots_re�ASCII�magic_rer�r;r=r?rGrHrSrXrYrZr`rbrardrUrerKrfrgr�r�rrrrr�s8      ;!a\  6   c@s eZdZdS)rN)r�r�r�rrrrr�sc@s8eZdZdZd dd�Zd dd�Zddd �Zdd d �ZdS)rz6CookieJar that can be loaded from and saved to a file.NFc CsJtj||�|dk r6y |dWntd��YnX||_t|�|_dS)z} Cookies are NOT loaded from the named file until either the .load() or .revert() method is called. NrVzfilename must be string-like)rr�rL�filenamerT� delayload)r�rlrmr:rrrr��s  zFileCookieJar.__init__cCs t��dS)zSave cookies to a file.N)r�)r�rl�ignore_discard�ignore_expiresrrr�save�szFileCookieJar.savec CsJ|dkr"|jdk r|j}ntt��t|��}|j||||�WdQRXdS)zLoad cookies from a file.N)rlrL�MISSING_FILENAME_TEXT�open� _really_load)r�rlrnrorrrr�load�s   zFileCookieJar.loadcCs�|dkr"|jdk r|j}ntt��|jj�zFtj|j�}i|_y|j|||�Wnt k rn||_�YnXWd|jj �XdS)z�Clear all cookies and reload cookies from a saved file. Raises LoadError (or OSError) if reversion is not successful; the object's state will not be altered if this happens. N) rlrLrqr8rIr��deepcopyr9rt�OSErrorrJ)r�rlrnroZ old_staterrr�reverts    zFileCookieJar.revert)NFN)NFF)NFF)NFF)r�r�r�r�r�rprtrwrrrrr�s    cCs$|j|jfd|jfd|jfg}|jdk r8|jd|jf�|jrH|jd�|jrX|jd�|jrh|jd�|j rx|jd�|j r�|jd t t |j ��f�|j r�|jd�|jr�|jd |jf�|jr�|jd |jf�t|jj��}x$|D]}|j|t|j|�f�q�W|jd t|j�f�t|g�S)z�Return string representation of Cookie in the LWP cookie file format. Actually, the format is extended a bit -- see module docstring. r�r�Nr�� path_spec� port_spec� domain_dotr�r�r�r�rMr�)rxN)ryN)rzN)r�N)r�N)rzr{r�r�r�rtr�r�r�r�r�r5rZr�r�r�r*r�r+rmr�r�)r�r�r+r�rrr�lwp_cookie_strs6         r{c@s,eZdZdZd dd�Zd dd�Zd d �ZdS) ra[ 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) TcCs\tj�}g}x>|D]6}| r$|jr$q| r6|j|�r6q|jdt|��qWdj|dg�S)z�Return cookies as a string of "\n"-separated "Set-Cookie3" headers. ignore_discard and ignore_expires: see docstring for FileCookieJar.save zSet-Cookie3: %s� rV)rMr�r�rtr{r~)r�rnror�rhr�rrr� as_lwp_strGs  zLWPCookieJar.as_lwp_strNFc CsX|dkr"|jdk r|j}ntt��t|d��"}|jd�|j|j||��WdQRXdS)N�wz#LWP-Cookies-2.0 )rlrLrqrr�writer})r�rlrnrorrrrrpWs   zLWPCookieJar.savecCsL|j�}|jj|�s$d|}t|��tj�}d}d} d} �yʐx�|j�} | dkrRP| j|�s^q@| t|�d�j�} �x�t| g�D�]x} | d\} }i}i}x| D] }d||<q�Wx�| dd�D]t\}}|dk r�|j �}nd}|| k�s�|| k�r�|}|| k�r|dk�r d}|||<q�|| k�r*|||<q�|||<q�W|j }|d �}|d�}|dk �r^t |�}|dk�rld}|d �}|jd�}t |d�| ||d �|d�|||d�|d �|d�|d�|||d �|d�|�}| �r�|j �r�q�| �r�|j|��r�q�|j|�q�Wq@WWnBtk �r�Yn,tk �rFt�td|| f��YnXdS)Nz5%r does not look like a Set-Cookie3 (LWP) format filez Set-Cookie3:ryrxrzr�r�r�r�r�r�r�r�rMrVr FrTr�z&invalid Set-Cookie3 format file %r: %r)ryrxrzr�r�)r�r�r�r�r�r�rM)�readlinerkr@rrMrurr�r|rKr�rdrr�r�rarvr]r)r�rrlrnro�magicrr��headerrPrQ�line�datarzr{rRr�r�r�r�r�r�r�r�r�rcrrrrscs�                   zLWPCookieJar._really_load)TT)NFF)r�r�r�r�r}rprsrrrrr:s   c@s0eZdZdZejd�ZdZdd�Zd dd �Z dS) ra� 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). z#( Netscape)? HTTP Cookie Filezr# Netscape HTTP Cookie File # http://curl.haxx.se/rfc/cookie_spec.html # This is a generated file! Do not edit. cCs|tj�}|j�}|jj|�s(td|���y �x|j�}|dkrBP|jd�rX|dd�}|j�jd�s0|j�dkrtq0|jd�\}} } } } } }| dk} | dk} | dkr�|} d}|jd �}| |ks�t �d }| dkr�d} d }t d | |dd || || d | | |ddi�}| �r|j �rq0| �r$|j |��r$q0|j |�q0WWnBtk �rL�Yn,tk �rvt�td ||f��YnXdS)Nz4%r does not look like a Netscape format cookies filerVr|r�#r� �TRUEr�FTr z+invalid Netscape format cookies file %r: %rr�)r�r)rMr�rkr@rr�r�rur�rnrr�r�rarvr]r)r�rrlrnror�r�r�r�r�r�r�r�rzr{r�r�rcrrrrs�sb     zMozillaCookieJar._really_loadNFc Cs|dkr"|jdk r|j}ntt��t|d���}|j|j�tj�}x�|D]�}| rZ|jrZqH| rl|j|�rlqH|j rxd}nd}|j j d�r�d}nd}|j dk r�t |j �} nd} |jdkr�d} |j} n |j} |j} |jdj|j ||j|| | | g�d�qHWWdQRXdS)Nr~r�ZFALSEr�rVr�r|)rlrLrqrrrr�rMr�r�r�r�rur�rmr{rzr~r�) r�rlrnrorr�r�r�r�r�rzr{rrrrps<          zMozillaCookieJar.save)NFF) r�r�r�r�rvrirkr�rsrprrrrr�s  A)N)N)Yr��__all__r�r-rvrMZ urllib.parser�Zurllib.requestZ threadingr6� ImportErrorZdummy_threadingZ http.clientZhttpZcalendarr r r rrmZclientZ HTTP_PORTr�rqrr%r,r6r7rIr(rtrKr5r8r>rirjr?rFrSrX�Ir\�Xr^rarbrdrjrorprrrqr|r}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr-r0r4rrvrrr{rrrrrr�<module>s�        88!    U D'    #b!\:x