B °-_Ï+ã @sdZddddddddgZd d lZd d lZd d lZd d lZd d lZd d lZd d l Z d d l Z d d l mZd Zd ad d„Zee jjƒZdZdd„ZdZdd„ZdddddddgZddddd d!d"d#d$d%d&d'g ZgZxeD]Ze e ¡¡qÐWdud(d)„Z dvd*d+„Z!d d d d d,œZ"e #d-ej$¡Z%d.d/„Z&d0d1„Z'e #d2ej$¡Z(e #d3ej)ej$B¡Z*e #d4ej+ej$B¡Z,d5d6„Z-e #d7ej+ej$B¡Z.d8d9„Z/d:d;„Z0e #d<¡Z1e #d=¡Z2e #d>¡Z3e #d?¡Z4d@dA„Z5e #dB¡Z6dCdD„Z7dEdF„Z8dGdH„Z9e #dIej$¡Z:dJdK„Z;dLdM„Ze #dRej$¡Z?dSdT„Z@dUdV„ZAdWdX„ZBdYdZ„ZCd[ZDe #d\¡ZEd]d^„ZFd_d`„ZGdadb„ZHdcdd„ZIGded„dƒZJGdfd„dƒZKGdgd„deKƒZLdhdi„ZMdjdk„ZNGdldm„dmƒZOGdnd„dƒZPGdod„deQƒZRGdpd„dePƒZSdqdr„ZTGdsd„deSƒZUGdtd„deSƒZVd 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}| d¡atj|ŽS)Nr zhttp.cookiejar)ÚdebugÚloggerÚloggingZ getLogger)Úargsr ©rú$/usr/lib/python3.7/http/cookiejar.pyÚ_debug+s  rzQa filename was not supplied (nor was the CookieJar instance initialised with one)cCsJddl}ddl}ddl}| ¡}| d|¡| ¡}|jd|dddS)Nr zhttp.cookiejar bug! %sé)Ú stacklevel)ÚioÚwarningsÚ tracebackÚStringIOÚ print_excÚgetvalueÚwarn)rrrÚfÚmsgrrrÚ_warn_unhandled_exception9s  ri²cCs¨|dd…\}}}}}}|tkr d|kr4dkr nnhd|krLdkr nnPd|krddkr nn8d|kr|dkr nn d|kr”dkr nnt|ƒSdSdS) Nééé ér éé;é=)Ú EPOCH_YEARr )ÚttÚyearÚmonthZmdayÚhourÚminÚsecrrrÚ_timegmHs 8Hr,ZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDeccCs@|dkrtj ¡}n tj |¡}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Ú time2isozVs   r5cCsR|dkrtj ¡}n tj |¡}dt| ¡|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Ú time2netscapeis   r8)ZGMTÚUTCZUTÚZz^([-+])?(\d\d?):?(\d\d)?$cCsjd}|tkrd}nTt |¡}|rfdt| d¡ƒ}| d¡rR|dt| d¡ƒ}| d¡dkrf| }|S)Nr iréé<rú-)Ú UTC_ZONESÚ TIMEZONE_REÚsearchÚintÚgroup)ÚtzÚoffsetÚmrrrÚoffset_from_tz_string€s  rFc Csˆt|ƒ}|tjkrdSyt | ¡¡d}WnXtk r„y t|ƒ}Wntk r\dSXd|krrdkr|nn|}ndSYnX|dkr’d}|dkržd}|dkrªd}t|ƒ}t|ƒ}t|ƒ}t|ƒ}|dkr0t t ¡¡d}|d} |} ||| }| | } t | ƒdkr0| dkr(|d}n|d}t |||||||fƒ} | dk r„|dkr^d}|  ¡}t |ƒ} | dkr|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Üt |¡}|rl| ¡}t |d ¡¡d}t|dƒ|t|dƒt|dƒt|dƒt|dƒf}t|ƒS|  ¡}t   d|d¡}dgd \}}}}}} } t  |¡}|dk rÄ| ¡\}}}}}} } 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| ¡}dgd\}}}}}}}t |¡}|dk rL| ¡\}}}}}}}} 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*| d¡\}}|jd|…|j|d…S)z)Return unmatched part of re.Match object.r N)ÚspanÚstring)ÚmatchÚstartÚendrrrÚ unmatchedEsrjz^\s*([^=\s;,]+)z&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"z^\s*=\s*([^\s;,]*)z\\(.)c Cs:t|tƒrt‚g}x |D]}|}g}xú|r"t |¡}|r¼t|ƒ}| d¡}t |¡}|r~t|ƒ}| d¡}t  d|¡}n.t  |¡}|r¨t|ƒ}| d¡}|  ¡}nd}|  ||f¡q*|  ¡ d¡rî|  ¡dd…}|rè|  |¡g}q*t dd|¡\}} | dkstd|||fƒ‚|}q*W|r|  |¡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* separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) qdtext = > 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_wordsNsF-         r|z([\"\\])cCs„g}xt|D]l}g}xN|D]F\}}|dk rTt d|¡sHt d|¡}d|}d||f}| |¡qW|r | d |¡¡q Wd |¡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| d¡r|dd…}| d¡r,|dd…}|S)Nú"réÿÿÿÿ)ruÚendswith)r_rrrÚ strip_quotes½s     r‡c Csd}g}xò|D]ê}g}d}xÀt| d¡ƒD]®\}}| ¡}| d¡\}} } | ¡}|sd|dkr*Pnq*| rp|  ¡nd} |dkrÊ| ¡} | |kr| }|dkr®| dk r¨t| ƒ} d}n|d krÊ| dk rÊtt| ƒƒ} | || f¡q*W|r|sî| d ¡| |¡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Úportzmax-ageFú;ú=r NrŒTrˆ)rŒÚ0)Ú 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:t |¡rdS|dkrdS|ddks2|ddkr6dSdS)z*Return True if text is a host domain name.FrVr Ú.r…T)ÚIPV4_REr@)r_rrrÚis_HDN s rcCsl| ¡}| ¡}||krdSt|ƒs(dS| |¡}|dksB|dkrFdS| d¡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. TFr…r r›rN)rKrÚrfindru)ÚAÚBÚirrrÚ domain_matchs  r¢cCst |¡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_HDN?s r£cCs`| ¡}| ¡}t|ƒr t|ƒs0||kr,dSdS| d¡}|rL| |¡rLdS|s\||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_matchIs  r¥z:\d+$cCsB| ¡}tj |¡d}|dkr,| dd¡}t d|d¡}| ¡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_host^s  r­cCs4t|ƒ}}| d¡dkr,t |¡s,|d}||fS)zzReturn a tuple (request-host, effective request-host name). As defined by RFC 2965, except both are lowercased. r›r…z.local)r­Úfindrœr@)rªÚerhnÚreq_hostrrrÚeff_request_hostns r±cCs4| ¡}tj |¡}t|jƒ}| d¡s0d|}|S)z6Path component of request-URI, as defined by RFC 2965.ú/)r¦r§r¨ZurlsplitÚ escape_pathrŠru)rªr«ÚpartsrŠrrrÚ request_pathys    rµcCs^|j}| d¡}|dkrV||dd…}y t|ƒWqZtk rRtd|ƒdSXnt}|S)Nú:r rznonnumeric port: '%s')r¬r®rArLrÚDEFAULT_HTTP_PORT)rªr¬r¡rrrrÚ request_portƒs   r¸z%/;:@&=+$,!~*'()z%([0-9a-fA-F][0-9a-fA-F])cCsd| d¡ ¡S)Nz%%%sr)rBrO)rgrrrÚuppercase_escaped_char•sr¹cCstj |t¡}t t|¡}|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| d¡}|dkrL||dd…}| d¡}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)rr‰rŠr{rz)rÊÚpÚlimitZ namevaluerrrÚ__str__"s   zCookie.__str__cCspg}x,dD]$}t||ƒ}| d|t|ƒf¡q W| dt|jƒ¡| dt|jƒ¡d|jjd |¡fS)N)rŒrzr{rrÀr‰rÁrÂrŠrÃr‹rˆrÄrÅrÆz%s=%szrest=%sz rfc2109=%sz%s(%s)z, )Ú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_okDszCookiePolicy.set_okcCs tƒ‚dS)zAReturn true if (and only if) cookie should be returned to server.N)rß)rÊràrªrrrÚ return_okMszCookiePolicy.return_okcCsdS)zMReturn false if cookies should not be returned, given cookie domain. Tr)rÊr‰rªrrrÚdomain_return_okQszCookiePolicy.domain_return_okcCsdS)zKReturn false if cookies should not be returned, given cookie path. Tr)rÊrŠrªrrrÚpath_return_okVszCookiePolicy.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 |ƒ|_ nd|_ |dk rft |ƒ}||_ dS)zAConstructor arguments should be passed as keyword arguments only.Nr) Ú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Ìfs  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_alloweds    z"DefaultCookiePolicy.is_not_allowedcCsPtd|j|jƒ|jdk st‚x,dD]$}d|}t||ƒ}|||ƒs$dSq$WdS)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=%sN)rŒÚ verifiabilityrzrŠr‰rZset_ok_FT)rrzr{rnr×)rÊràrªÚnÚfn_nameÚfnrrrrá¥s   zDefaultCookiePolicy.set_okcCsZ|jdkrtd|j|jƒdS|jdkr:|js:tdƒdS|jdkrV|jsVtdƒ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,|j d¡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|¡sHtd|j|ƒdSdS)Nr z7 path attribute %s is not a prefix of request path %sFT)rÃrµrŒrîrärŠr)rÊràrªÚreq_pathrrrÚ set_ok_pathÜs  zDefaultCookiePolicy.set_ok_pathc Csê| |j¡rtd|jƒdS| |j¡r8td|jƒdS|jræt|ƒ\}}|j}|jrÌ| d¡dkrÌ| d¡}| dd|¡}|dkrÌ||dd…}||d|…} |   ¡dkrÌt |ƒdkrÌtd |ƒdS|  d¡rä|dd…} n|} |   d¡dk} | s|d krtd |ƒdS|j dkrX| |¡sX|  d¡sXd| |¡sXtd ||ƒdS|j dksr|j|j@rŽt||ƒsŽtd ||ƒdS|j dks¨|j|j@ræ|dt |ƒ …} |   d¡dkræt |¡sætd| |ƒdSdS)Nz" domain %s is in user block-listFz& domain %s is not in user allow-listr›rr r)ÚcoZacZcomZeduZorgZnetZgovZmilrAZaeroZbizÚcatZcoopÚinfoZjobsZmobiZmuseumrzZproZtravelZeuz& 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)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çsb                 z!DefaultCookiePolicy.set_ok_domainc Cs†|jr‚t|ƒ}|dkrd}nt|ƒ}x\|j d¡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¸rmrr’rArLr)rÊràrªÚreq_portrÔrrrÚ set_ok_port"s"   zDefaultCookiePolicy.set_ok_portcCsBtd|j|jƒx,dD]$}d|}t||ƒ}|||ƒsdSqWdS)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=%s)rŒrør‹rˆrr‰Z return_ok_FT)rrzr{r×)rÊràrªrùrúrûrrrrâ7s    zDefaultCookiePolicy.return_okcCs<|jdkr|jstdƒdS|jdkr8|js8tdƒdSdS)Nr z$ RFC 2965 cookies are switched offFz$ Netscape cookies are switched offT)rŒrærrå)rÊràrªrrrÚreturn_ok_versionIsz%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_verifiabilityRsz+DefaultCookiePolicy.return_ok_verifiabilitycCs |jr|jdkrtdƒdSdS)NZhttpsz( secure cookie with non-secure requestFT)r‹Útyper)rÊràrªrrrÚreturn_ok_secure^sz$DefaultCookiePolicy.return_ok_securecCs| |j¡rtdƒdSdS)Nz cookie expiredFT)rÓÚ_nowr)rÊràrªrrrÚreturn_ok_expiresds z%DefaultCookiePolicy.return_ok_expirescCsP|jrLt|ƒ}|dkrd}x0|j d¡D]}||kr(Pq(Wtd||jƒdSdS)Nr rkz0 request port %s does not match cookie port %sFT)rr¸r’r)rÊràrªr rÔrrrÚreturn_ok_portjs z"DefaultCookiePolicy.return_ok_portcCs®t|ƒ\}}|j}|r*| d¡s*d|}n|}|jdkr^|j|j@r^|js^||kr^tdƒdS|jdkr‚t||ƒs‚td||ƒdS|jdkrªd|  |¡sª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_domainxs&    z$DefaultCookiePolicy.return_ok_domaincCs˜t|ƒ\}}| d¡sd|}| d¡s0d|}|rH| d¡sHd|}n|}| |¡sd| |¡sddS| |¡r|td|ƒdS| |¡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¯rrrrrã“s"        z$DefaultCookiePolicy.domain_return_okcCsbtd|ƒt|ƒ}t|ƒ}||kr&dS| |¡rR| d¡sN|||d…dkrRdStd||ƒdS)Nz- checking cookie path=%sTr²rz %s does not path-match %sF)rrµrrur†)rÊrŠrªrZpathlenrrrrä­s   z"DefaultCookiePolicy.path_return_ok) rÚrÜrÝrÞr rrZ DomainLiberalZ DomainStrictrÌròrôrõrórör÷rárürþrrr rrârrrrrrrãrärrrrr\sL    ;  cCst| ¡ƒ}t|j|ƒS)N)ÚsortedÚkeysÚmaprÎ)ZadictrrrrÚvals_sorted_by_keyºs rc 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Úobjrrrr¾s  rc@s eZdZdS)ÚAbsentN)rÚrÜrÝrrrrr#Ðsr#c@süeZdZdZe d¡Ze d¡Ze d¡Ze d¡Z e d¡Z e dej ¡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ƒ}||_t ¡|_i|_dS)N)rÚ_policyÚ _threadingÚRLockÚ _cookies_lockÚ_cookies)rÊÚpolicyrrrrÌás  zCookieJar.__init__cCs ||_dS)N)r$)rÊr)rrrÚ set_policyészCookieJar.set_policycCs”g}|j ||¡sgStd|ƒ|j|}xd| ¡D]X}|j ||¡sHq4||}x:| ¡D].}|j ||¡svtdƒqZtdƒ| |¡qZWq4W|S)Nz!Checking %s for cookies to returnz not returning cookiez it's a match) r$rãrr(rrär!rârt)rÊr‰rªÚcookiesZcookies_by_pathrŠZcookies_by_nameràrrrÚ_cookies_for_domainìs   zCookieJar._cookies_for_domaincCs.g}x$|j ¡D]}| | ||¡¡qW|S)z2Return a list of cookies to be returned to server.)r(rÚextendr,)rÊrªr+r‰rrrÚ_cookies_for_requestþszCookieJar._cookies_for_requestc CsF|jdd„ddd}g}x$|D]}|j}|sLd}|dkrL| d|¡|jdk r~|j |j¡r~|dkr~|j d |j¡}n|j}|jdkrœ| |j¡n| d |j|f¡|dkr"|j rÎ| d |j ¡|j   d ¡r|j }|j s|  d ¡r|d d…}| d|¡|jdk r"d}|jr4|d|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Úóz)CookieJar._cookie_attrs..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ÂrrÀ) rÊr+r•ÚattrsràrŒr{r‰rÔrrrÚ _cookie_attrss>      zCookieJar._cookie_attrscCsºtdƒ|j ¡zŽtt ¡ƒ|j_|_| |¡}| |¡}|r^|  d¡s^|  dd  |¡¡|jj rž|jj sž|  d¡sžx$|D]}|jdkr~|  dd¡Pq~WWd|j ¡X| ¡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)rr'ÚacquirerArMr$rr.r7Z has_headerZadd_unredirected_headerr~rærèrŒÚreleaseÚclear_expired_cookies)rÊrªr+r6ràrrrr8@s$          zCookieJar.add_cookie_headerc Csg}d}d}x||D]r}|d\}}d}d} i} i} x4|dd…D]"\} } |  ¡}||ksh||krl|} | |kr€| dkr€d} | | krŠqF| dkr°| dkr¨td ƒd} P|  ¡} | d krÐ|r¾qF| dkrÐtd ƒqF| d krd}y t| ƒ} Wn$tk rtd ƒd} PYnXd } |j| } | |ks2| |krb| dkrX| dkrXtd| ƒd} P| | | <qF| | | <qFW| rvq| ||| | 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ˆzmax-ager‰rŠrrÅÚ commenturlr FrNTr‰z% missing value for domain attributerˆzM missing or invalid value for expires attribute: treating as session cookiezmax-agez? missing or invalid (non-numeric) value for max-age attribute)rrÅr<z! missing value for %s attribute)rKrrArLrrt)rÊÚ attrs_setÚ cookie_tuplesÚ boolean_attrsÚ value_attrsZ cookie_attrsrzr{Z max_age_setZ bad_cookieÚstandardrËrr‚r™rrrÚ_normalized_cookie_tuplesasf          z#CookieJar._normalized_cookie_tuplescCs$|\}}}}| dt¡}| dt¡}| dt¡} | dt¡} | dd¡} | dk rry t| ƒ} Wntk rpdSX| dd¡} | dd¡} | d d¡}| d d¡}|tk rÀ|d krÀd }t|ƒ}nXd}t|ƒ}| d ¡}|dkr| dkrö|d|…}n|d|d…}t|ƒdkrd }|tk }d}|r8t|  d¡ƒ}|tkrTt |ƒ\}}|}n|  d¡shd|}d}| tk rž| dkrŠt |ƒ} nd }t   dd | ¡} nd} | tkr¶d} d } nH| |jkrþy| |||¡Wntk rêYnXtd|||ƒdSt| ||| ||||||| | | |||ƒS)Nr‰rŠrrˆrŒr‹FrÄrÅr<rVTr²r…r rr›z\s+z2Expiring cookie, domain='%s', path='%s', name='%s')rÎr#rArLr³rµržrÚboolrur±r¸rvr]rÚclearÚKeyErrorrr)rÊÚtuprªrzr{rArËr‰rŠrrˆrŒr‹rÄrÅrÆrÃr¡rÁrÂr°r¯rÀrrrÚ_cookie_from_cookie_tupleÂs‚                       z#CookieJar._cookie_from_cookie_tuplecCs:| |¡}g}x&|D]}| ||¡}|r| |¡qW|S)N)rBrGrt)rÊr=rªr>r+rFrà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×r$rærŒrÇ)rÊr+Z rfc2109_as_nsràrrrÚ_process_rfc2109_cookies's   z"CookieJar._process_rfc2109_cookiesc Cs(| ¡}| dg¡}| dg¡}|jj}|jj}|s8|rP|s@|rP|sH|rP|sT|sTgSy| t|ƒ|¡}Wntk r†tƒg}YnX|r$|r$y| t |ƒ|¡} Wntk rÆtƒg} YnX|  | ¡|ri} x |D]} d| | j | j | j f<qâW| fdd„} t| | ƒ} | r$| | ¡|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..no_matching_rfc2965)rZget_allr$rærårHr|Ú ExceptionrršrIr‰rŠrzÚfilterr-) rÊÚresponserªrZ rfc2965_hdrsZns_hdrsrærår+Z ns_cookiesrJràrKrrrÚ make_cookies3sB          zCookieJar.make_cookiescCsN|j ¡z2tt ¡ƒ|j_|_|j ||¡r:| |¡Wd|j ¡XdS)z-Set a cookie if policy says it's OK to do so.N) r'r9rArMr$rráÚ set_cookier:)rÊràrªrrrÚset_cookie_if_okis  zCookieJar.set_cookie_if_okcCsl|j}|j ¡zJ|j|kr&i||j<||j}|j|krDi||j<||j}|||j<Wd|j ¡XdS)z?Set a cookie, without checking whether or not it should be set.N)r(r'r9r‰rŠrzr:)rÊràÚcZc2Zc3rrrrPvs     zCookieJar.set_cookiecCs|td| ¡ƒ|j ¡zRtt ¡ƒ|j_|_x6| ||¡D]&}|j  ||¡r>td|ƒ|  |¡q>WWd|j  ¡XdS)zAExtract cookies from response, where allowable given the request.zextract_cookies: %sz setting cookie: %sN) rrr'r9rArMr$rrOrárPr:)rÊrNrª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)rLr()rÊr‰rŠrzrrrrD‘s  zCookieJar.clearcCsH|j ¡z,x&|D]}|jr| |j|j|j¡qWWd|j ¡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)r'r9rÄrDr‰rŠrzr:)rÊràrrrÚclear_session_cookies¬s   zCookieJar.clear_session_cookiescCsT|j ¡z8t ¡}x*|D]"}| |¡r| |j|j|j¡qWWd|j ¡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) r'r9rMrÓrDr‰rŠrzr:)rÊrÒràrrrr;»s   zCookieJar.clear_expired_cookiescCs t|jƒS)N)rr()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]}| t|ƒ¡q Wd|jjd |¡fS)Nz<%s[%s]>z, )rtrØrÙrÚr~)rÊÚrràrrrrÛ×s zCookieJar.__repr__cCs6g}x|D]}| t|ƒ¡q Wd|jjd |¡fS)Nz<%s[%s]>z, )rtrmrÙrÚr~)rÊrWràrrrrÖÜs zCookieJar.__str__)N)NNN)"rÚrÜrÝrÞrvÚcompiler4r5Zstrict_domain_reZ domain_reZdots_reÚASCIIÚmagic_rerÌr*r,r.r7r8rBrGrHrIrOrQrPrSrDrTr;rUrVrÛ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.NFcCsJt ||¡|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ÚfilenamerCÚ delayload)rÊr[r\r)rrrrÌès  zFileCookieJar.__init__cCs tƒ‚dS)zSave cookies to a file.N)rß)rÊr[Úignore_discardÚignore_expiresrrrÚsave÷szFileCookieJar.savec CsJ|dkr"|jdk r|j}nttƒ‚t|ƒ}| ||||¡WdQRXdS)zLoad cookies from a file.N)r[rLÚMISSING_FILENAME_TEXTÚopenÚ _really_load)rÊr[r]r^rrrrÚloadûs   zFileCookieJar.loadcCs„|dkr"|jdk r|j}nttƒ‚|j ¡zFt |j¡}i|_y| |||¡Wnt k rn||_‚YnXWd|j  ¡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) r[rLr`r'r9rÈZdeepcopyr(rcÚOSErrorr:)rÊr[r]r^Z old_staterrrÚreverts    zFileCookieJar.revert)NFN)NFF)NFF)NFF)rÚrÜrÝrÞrÌr_rcrerrrrrås    cCs$|j|jfd|jfd|jfg}|jdk r8| d|jf¡|jrH| d¡|jrX| d¡|jrh| d¡|j rx| d¡|j r–| d t t |j ƒƒf¡|j r¦| d ¡|jr¼| d |jf¡|jrÒ| d |jf¡t|j ¡ƒ}x$|D]}| |t|j|ƒf¡qæW| d t|jƒf¡t|gƒS)zReturn string representation of Cookie in the LWP cookie file format. Actually, the format is extended a bit -- see module docstring. rŠr‰Nr)Ú path_specN)Ú port_specN)Ú domain_dotN)r‹Nrˆ)rÄNrÅr<rŒ)rzr{rŠr‰rrtrÃrÀrÂr‹rˆr5rZrÄrÅrÆrrÉrrmrŒrƒ)ràr¼rrrrrÚlwp_cookie_strs6         ric@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) TcCsXt ¡}g}x:|D]2}|s"|jr"q|s2| |¡r2q| dt|ƒ¡qWd |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Órtrir~)rÊr]r^rÒrWràrrrÚ as_lwp_strHs  zLWPCookieJar.as_lwp_strNFc CsX|dkr"|jdk r|j}nttƒ‚t|dƒ"}| d¡| | ||¡¡WdQRXdS)NÚwz#LWP-Cookies-2.0 )r[rLr`raÚwriterk)rÊr[r]r^rrrrr_Xs   zLWPCookieJar.savecCsD| ¡}|j |¡s$d|}t|ƒ‚t ¡}d}d} d} yÂxº| ¡} | dkrRP|  |¡s^q@| t|ƒd… ¡} x€t| gƒD]p} | d\} }i}i}x| D] }d||<q Wx€| dd…D]p\}}|dk rØ|  ¡}nd}|| ksì|| krð|}|| kr|dkrd }|||<q¾|| kr&|||<q¾|||<q¾W|j }|d ƒ}|d ƒ}|dk rZt |ƒ}|dkrhd }|d ƒ}| d ¡}t |dƒ| ||dƒ|dƒ|||dƒ|dƒ|dƒ|dƒ|||dƒ|dƒ|ƒ}|sÔ|j rÔq€|sè| |¡rèq€| |¡q€Wq@WWnBtk r‚Yn,tk r>tƒtd|| fƒ‚YnXdS)Nz5%r does not look like a Set-Cookie3 (LWP) format filez Set-Cookie3:)rgrfrhr‹rÄ)rŒrrŠr‰rˆrÅr<rVr FrTrˆrÄr‰r›rŒrrgrhrŠrfr‹rÅr<z&invalid Set-Cookie3 format file %r: %r)ÚreadlinerZr@rrMrurr“r|rKrÎrdrrÄrÓrPrdrLr)rÊrr[r]r^ÚmagicrrÒÚheaderr?r@ÚlineÚdatarzr{rArËrr‚r™r¼rˆrÄr‰rÁrRrrrrbds„                   zLWPCookieJar._really_load)TT)NFF)rÚrÜrÝrÞrkr_rbrrrrr;s   c@s0eZdZdZe d¡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. cCsvt ¡}| ¡}|j |¡s(td|ƒ‚yxþ| ¡}|dkr@P| d¡rV|dd…}| ¡ d¡s.| ¡dkrrq.| d¡\}} } } } } }| dk} | dk} | dkrª|} d}| d¡}| |ksÀt ‚d }| dkrÔd} d }t d | |dd || || d | | |ddiƒ}|s |j r q.|s|  |¡rq.|  |¡q.WWnBtk rF‚Yn,tk rptƒtd ||fƒ‚YnXdS) Nz4%r does not look like a Netscape format cookies filerVrjr…)ú#rÿú ÚTRUEr›FTr z+invalid Netscape format cookies file %r: %r)rMrnrZr@rr†r“rur’rnrrÄrÓrPrdrLr)rÊrr[r]r^rÒrorqr‰rÁrŠr‹rˆrzr{r¤rÄrRrrrrbÚsb     zMozillaCookieJar._really_loadNFc Cs|dkr"|jdk r|j}nttƒ‚t|dƒÌ}| |j¡t ¡}x°|D]¨}|sX|jrXqH|sh| |¡rhqH|j rtd}nd}|j   d¡rŠd}nd}|j dk r¤t |j ƒ} nd} |jdkr¾d} |j} n |j} |j} | d |j ||j|| | | g¡d¡qHWWdQRXdS)NrlruZFALSEr›rVrtrj)r[rLr`rarmrprMrÄrÓr‹r‰rurˆrmr{rzr~rŠ) rÊr[r]r^rrÒràr‹r¤rˆrzr{rrrr_s<          zMozillaCookieJar.save)NFF) rÚrÜrÝrÞrvrXrZrprbr_rrrrr³s  A)N)N)WrÞÚ__all__rÈr-rvrMZ urllib.parser§Zurllib.requestZ threadingr%Z http.clientZhttpZcalendarr r r rrmZclientZ HTTP_PORTr·r`rr%r,r6r7rIr(rtrKr5r8r>rXrYr?rFrSrXÚIr\ÚXr^rarbrdrjrorprrrqr|r}rƒr‡ršrœrr¢r£r¥r©r­r±rµr¸rºr»r¹r³r¾r¿rrrrrr#rrdrrrirrrrrrÚsª       88!    U D'    #b!`:x