ó zfc @südZddddddddd g Zd d lZd d lZd d lZd d lZd d lZyd d lZWne k r’d d l ZnXd d l Z d d l m Z eZead „Zee jƒZdZd„ZdZd„ZdddddddgZdddddddd d!d"d#d$g ZgZx!eD]ZejejƒƒqCWed%„Z ed&„Z!ied'6ed(6ed)6ed*6Z"ej#d+ƒZ$d,„Z%d-„Z&ej#d.ƒZ'ej#d/ej(ƒZ)ej#d0ej*ƒZ+d1„Z,ej#d2ej*ƒZ-d3„Z.d4„Z/ej#d5ƒZ0ej#d6ƒZ1ej#d7ƒZ2ej#d8ƒZ3d9„Z4ej#d:ƒZ5d;„Z6d<„Z7d=„Z8ej#d>ƒZ9d?„Z:d@„Z;dA„Z<dB„Z=ej#dCƒZ>dD„Z?dE„Z@dF„ZAdG„ZBdHZCej#dIƒZDdJ„ZEdK„ZFdL„ZGdM„ZHdfdN„ƒYZIdfdO„ƒYZJdeJfdP„ƒYZKdQ„ZLdR„ZMdSfdT„ƒYZNdfdU„ƒYZOdePfdV„ƒYZQdeOfdW„ƒYZRd dXlSmTZTmUZUd dYlVmWZWd S(Zsª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 tCookiet CookieJart CookiePolicytDefaultCookiePolicyt FileCookieJart LWPCookieJartlwp_cookie_strt LoadErrortMozillaCookieJariÿÿÿÿN(ttimegmcGs;ts dSts.ddl}|jdƒantj|ŒS(Niÿÿÿÿt cookielib(tdebugtloggertloggingt getLogger(targsR ((s!/usr/lib64/python2.7/cookielib.pyt_debug+s  sQa filename was not supplied (nor was the CookieJar instance initialised with one)cCsgddl}ddl}ddl}|jƒ}|jd|ƒ|jƒ}|jd|ddƒdS(Niÿÿÿÿscookielib bug! %st stackleveli(twarningst tracebacktStringIOt print_exctNonetgetvaluetwarn(RRRtftmsg((s!/usr/lib64/python2.7/cookielib.pyt_warn_unhandled_exception9s $  i²cCsÆ|d \}}}}}}|tkr¾d|ko?dknr¾d|ko[dknr¾d|kowdknr¾d|ko“dknr¾d|ko¯dknr¾t|ƒSdSdS( Niii iiii;i=(t EPOCH_YEARR R(ttttyeartmonthtmdaythourtmintsec((s!/usr/lib64/python2.7/cookielib.pyt_timegmHs DT tMontTuetWedtThutFritSattSuntJantFebtMartAprtMaytJuntJultAugtSeptOcttNovtDeccCsZ|dkrtjƒ}ntj|ƒd \}}}}}}d||||||fS(sHReturn 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 is%04d-%02d-%02d %02d:%02d:%02dZN(Rttimetgmtime(ttRtmonR R!R"R#((s!/usr/lib64/python2.7/cookielib.pyt time2isozVs %cCsl|dkrtjƒ}ntj|ƒd \}}}}}}}dt||t|d||||fS(sð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 is#%s, %02d-%s-%04d %02d:%02d:%02d GMTiN(RR8R9tDAYStMONTHS(R:RR;R R!R"R#twday((s!/usr/lib64/python2.7/cookielib.pyt time2netscapegs (tGMTtUTCtUTtZs^([-+])?(\d\d?):?(\d\d)?$cCsžd}|tkrd}ntj|ƒ}|ršdt|jdƒƒ}|jdƒrx|dt|jdƒƒ}n|jdƒdkrš| }qšn|S(Niiiii<it-(Rt UTC_ZONESt TIMEZONE_REtsearchtinttgroup(ttztoffsettm((s!/usr/lib64/python2.7/cookielib.pytoffset_from_tz_string{s    c Csýytj|jƒƒd}Wn_tk r~yt|ƒ}Wntk rQdSXd|koidknrw|}qdSnX|dkr”d}n|dkr©d}n|dkr¾d}nt|ƒ}t|ƒ}t|ƒ}t|ƒ}t|ƒ}|dkr‚tjtjƒƒd}|d} |} ||| }| | } t| ƒdkr‚| dkrr|d}q|d}q‚nt |||||||fƒ} | dk rù|dkrÄd}n|j ƒ}t |ƒ} | dkrìdS| | } n| S(Nii iièidi2RB( t MONTHS_LOWERtindextlowert ValueErrorRIRR8t localtimetabsR$tupperRN( tdayR;tyrthrR"R#RKtimontcur_yrRMttmpR:RL((s!/usr/lib64/python2.7/cookielib.pyt _str2time‰sR               !       sV^[SMTWF][a-z][a-z], (\d\d) ([JFMASOND][a-z][a-z]) (\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$s+^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)[a-z]*,?\s*sò^ (\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 Cs4tj|ƒ}|r’|jƒ}tj|djƒƒd}t|dƒ|t|dƒt|dƒt|dƒt|dƒf}t|ƒS|j ƒ}t j d|dƒ}d gd\}}}}}} } t j|ƒ}|d k r|jƒ\}}}}}} } nd St|||||| | ƒS( sÕ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. iiiiiitiN(tSTRICT_DATE_RERHtgroupsRORPRQRItfloatR$tlstript WEEKDAY_REtsubRtLOOSE_HTTP_DATE_RER\( ttextRMtgR;RRVRWRXR"R#RK((s!/usr/lib64/python2.7/cookielib.pyt http2timeØs -  " $sÖ^ (\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 Cs�|jƒ}dgd\}}}}}}}tj|ƒ}|dk rp|jƒ\}}}}}}}} ndSt|||||||ƒS(sv 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 iN(RaRt ISO_DATE_RERHR_R\( ReRVR;RWRXR"R#RKRMt_((s!/usr/lib64/python2.7/cookielib.pytiso2time"s " 'cCs+|jdƒ\}}|j| |j|S(s)Return unmatched part of re.Match object.i(tspantstring(tmatchtstarttend((s!/usr/lib64/python2.7/cookielib.pyt unmatchedCss^\s*([^=\s;,]+)s&^\s*=\s*\"([^\"\\]*(?:\\.[^\"\\]*)*)\"s^\s*=\s*([^\s;,]*)s\\(.)c Csg}xr|D]j}|}g}x?|r`tj|ƒ}|røt|ƒ}|jdƒ}tj|ƒ}|r�t|ƒ}|jdƒ}tjd|ƒ}nEtj|ƒ}|rÜt|ƒ}|jdƒ}|jƒ}nd}|j ||fƒq"|j ƒj dƒr<|j ƒd}|r3|j |ƒng}q"t jdd|ƒ\}} |}q"W|r |j |ƒq q W|S(smParse 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"')]] is\1t,s^[=\s;]*R]N(tHEADER_TOKEN_RERHRpRJtHEADER_QUOTED_VALUE_REtHEADER_ESCAPE_RERctHEADER_VALUE_REtrstripRtappendRat startswithtretsubn( t header_valuestresultRet orig_texttpairsRMtnametvaluetnon_junkt nr_junk_chars((s!/usr/lib64/python2.7/cookielib.pytsplit_header_wordsLs>.       s([\"\\])cCs½g}x§|D]Ÿ}g}xq|D]i\}}|dk r|tjd|ƒsitjd|ƒ}d|}nd||f}n|j|ƒq W|r |jdj|ƒƒq q Wdj|ƒS(s»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"' s^\w+$s\\\1s"%s"s%s=%ss; s, N(RRyRHtHEADER_JOIN_ESCAPE_RERcRwtjoin(tliststheadersR~tattrtktv((s!/usr/lib64/python2.7/cookielib.pytjoin_header_words¢s    cCs<|jdƒr|d}n|jdƒr8|d }n|S(Nt"iiÿÿÿÿ(Rxtendswith(Re((s!/usr/lib64/python2.7/cookielib.pyt _strip_quotes»s   c Cs†d }g}xs|D]k}g}t}x*t|jdƒƒD]\}}|jƒ}|jd ƒ\}} } |jƒ}|s“|d kr;Pq“q;n| r¥| jƒnd } |d kr;|jƒ} | |krØ| }n|dkr| d k rÿt| ƒ} nt}q;|dkr;| d k r8t t| ƒƒ} q8q;n|j || fƒq;W|r|sn|j dƒn|j |ƒqqW|S(s5Ad-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. texpirestdomaintpathtsecuretversiontportsmax-aget;t=it0(R�R�R‘R’R“R”smax-ageN(R“R—( tFalset enumeratetsplittstript partitionRRQRŽtTrueRgRw( t ns_headerst known_attrsR|t ns_headerR~t version_settiitparamtkeytseptvaltlc((s!/usr/lib64/python2.7/cookielib.pytparse_ns_headersÂs@ "            s\.\d+$cCsKtj|ƒrtS|dkr#tS|ddksC|ddkrGtStS(s*Return True if text is a host domain name.R]it.iÿÿÿÿ(tIPV4_RERHR˜R�(Re((s!/usr/lib64/python2.7/cookielib.pytis_HDNs  cCsŽ|jƒ}|jƒ}||kr(tSt|ƒs8tS|j|ƒ}|dks_|dkrctS|jdƒsvtSt|dƒsŠtStS(sý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. iÿÿÿÿiR©i(RQR�R«R˜trfindRx(tAtBti((s!/usr/lib64/python2.7/cookielib.pyt domain_matchs    cCstj|ƒrtStS(sdReturn True if text is a sort-of-like a host domain name. For accepting/blocking domains. (RªRHR˜R�(Re((s!/usr/lib64/python2.7/cookielib.pytliberal_is_HDN=scCs‡|jƒ}|jƒ}t|ƒo-t|ƒsD||kr@tStS|jdƒ}|rl|j|ƒrltS| rƒ||krƒtStS(s\For blocking/accepting domains. A and B may be host domain names or IP addresses. R©(RQR±R�R˜RxR�(R­R®t initial_dot((s!/usr/lib64/python2.7/cookielib.pytuser_domain_matchGs   s:\d+$cCs_|jƒ}tj|ƒd}|dkr@|jddƒ}ntjd|dƒ}|jƒS(sˆReturn request-host, as defined by RFC 2965. Variation from RFC: returned value is lowercased, for convenient comparison. iR]tHost(t get_full_urlturlparset get_headert cut_port_reRcRQ(trequestturlthost((s!/usr/lib64/python2.7/cookielib.pyt request_host\s   cCsLt|ƒ}}|jdƒdkrBtj|ƒ rB|d}n||fS(szReturn a tuple (request-host, effective request-host name). As defined by RFC 2965, except both are lowercased. R©iÿÿÿÿs.local(R¼tfindRªRH(R¹terhntreq_host((s!/usr/lib64/python2.7/cookielib.pyteff_request_hostls% cCsJ|jƒ}tj|ƒ}t|jƒ}|jdƒsFd|}n|S(s6Path component of request-URI, as defined by RFC 2965.t/(RµR¶turlsplitt escape_pathR‘Rx(R¹RºtpartsR‘((s!/usr/lib64/python2.7/cookielib.pyt request_pathws   cCsr|jƒ}|jdƒ}|dkrh||d}yt|ƒWqntk rdtd|ƒdSXnt}|S(Nt:iisnonnumeric port: '%s'(tget_hostR½RIRRRRtDEFAULT_HTTP_PORT(R¹R»R¯R”((s!/usr/lib64/python2.7/cookielib.pyt request_port�s    s%/;:@&=+$,!~*'()s%([0-9a-fA-F][0-9a-fA-F])cCsd|jdƒjƒS(Ns%%%si(RJRU(Rm((s!/usr/lib64/python2.7/cookielib.pytuppercase_escaped_char“scCsIt|tƒr!|jdƒ}ntj|tƒ}tjt|ƒ}|S(sEEscape any invalid characters in HTTP URL, and uppercase all escapes.sutf-8( t isinstancetunicodetencodeturllibtquotetHTTP_PATH_SAFEtESCAPED_CHAR_RERcRÊ(R‘((s!/usr/lib64/python2.7/cookielib.pyRÕs cCsk|jdƒ}|dkrg||d}|jdƒ}t|ƒrg|dks\|dkrgd|Sn|S(sBReturn 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©iitlocal(R½R«(thR¯tb((s!/usr/lib64/python2.7/cookielib.pytreach¥s $ cCs3t|ƒ}t|t|jƒƒƒs+tStSdS(sÜ 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. N(R¼R°RÕtget_origin_req_hostR�R˜(R¹R¿((s!/usr/lib64/python2.7/cookielib.pytis_third_partyÈs cBsVeZdZed„Zd„Zdd„Zd„Zdd„Z d„Z d„Z RS( sÐ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. cCs |dk rt|ƒ}n| dk r6t| ƒ} n|dkr]|tkr]tdƒ‚n||_||_||_||_||_|j ƒ|_ ||_ ||_ | |_ | |_| |_| |_| |_||_||_||_tj|ƒ|_dS(Ns-if port is None, port_specified must be false(RRIR�RRR“RR€R”tport_specifiedRQR�tdomain_specifiedtdomain_initial_dotR‘tpath_specifiedR’R�tdiscardtcommentt comment_urltrfc2109tcopyt_rest(tselfR“RR€R”RØR�RÙRÚR‘RÛR’R�RÜRÝRÞtrestRß((s!/usr/lib64/python2.7/cookielib.pyt__init__ës.                 cCs ||jkS(N(Rá(RâR((s!/usr/lib64/python2.7/cookielib.pythas_nonstandard_attrscCs|jj||ƒS(N(Rátget(RâRtdefault((s!/usr/lib64/python2.7/cookielib.pytget_nonstandard_attrscCs||j|(R”RR�R‘R€R(Râtptlimitt namevalue((s!/usr/lib64/python2.7/cookielib.pyt__str__"s   cCsˆg}x:dD]2}t||ƒ}|jd|t|ƒfƒq W|jdt|jƒƒ|jdt|jƒƒddj|ƒS(NR“RR€R”RØR�RÙRÚR‘RÛR’R�RÜRÝRÞs%s=%ssrest=%ss rfc2109=%ss Cookie(%s)s, (R“RR€R”RØR�RÙRÚR‘RÛR’R�RÜRÝRÞ(tgetattrRwtreprRáRßR…(RâRRRˆ((s!/usr/lib64/python2.7/cookielib.pyt__repr__,s !N( t__name__t __module__t__doc__R˜RäRåRRèRéRëRïRò(((s!/usr/lib64/python2.7/cookielib.pyRÙs     cBs2eZdZd„Zd„Zd„Zd„ZRS(s 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 customised policy. cCs tƒ‚dS(sÄ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(tNotImplementedError(RâtcookieR¹((s!/usr/lib64/python2.7/cookielib.pytset_okDscCs tƒ‚dS(sAReturn true if (and only if) cookie should be returned to server.N(Rö(RâR÷R¹((s!/usr/lib64/python2.7/cookielib.pyt return_okMscCstS(sMReturn false if cookies should not be returned, given cookie domain. (R�(RâR�R¹((s!/usr/lib64/python2.7/cookielib.pytdomain_return_okQscCstS(sKReturn false if cookies should not be returned, given cookie path. (R�(RâR‘R¹((s!/usr/lib64/python2.7/cookielib.pytpath_return_okVs(RóRôRõRøRùRúRû(((s!/usr/lib64/python2.7/cookielib.pyR;s   c Bs#eZdZdZdZdZdZeeBZdde e de e e e ee e d„ Z d„Z d„Z d„Zd „Zd „Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!RS(sBImplements the standard rules for accepting and returning cookies.iiiic Cs©||_||_||_||_||_||_| |_| |_| |_| |_ |dk rxt |ƒ|_ n d|_ |dk rœt |ƒ}n||_ dS(sAConstructor arguments should be passed as keyword arguments only.N((tnetscapetrfc2965trfc2109_as_netscapet hide_cookie2t strict_domaintstrict_rfc2965_unverifiabletstrict_ns_unverifiabletstrict_ns_domaintstrict_ns_set_initial_dollartstrict_ns_set_pathRttuplet_blocked_domainst_allowed_domains( Râtblocked_domainstallowed_domainsRüRýRþRÿRRRRRR((s!/usr/lib64/python2.7/cookielib.pyRäfs             cCs|jS(s4Return the sequence of blocked domains (as a tuple).(R(Râ((s!/usr/lib64/python2.7/cookielib.pyR ‡scCst|ƒ|_dS(s$Set the sequence of blocked domains.N(RR(RâR ((s!/usr/lib64/python2.7/cookielib.pytset_blocked_domainsŠscCs+x$|jD]}t||ƒr tSq WtS(N(RR³R�R˜(RâR�tblocked_domain((s!/usr/lib64/python2.7/cookielib.pyt is_blockedŽscCs|jS(s=Return None, or the sequence of allowed domains (as a tuple).(R(Râ((s!/usr/lib64/python2.7/cookielib.pyR ”scCs(|dk rt|ƒ}n||_dS(s-Set the sequence of allowed domains, or None.N(RRR(RâR ((s!/usr/lib64/python2.7/cookielib.pytset_allowed_domains—s cCs>|jdkrtSx$|jD]}t||ƒrtSqWtS(N(RRR˜R³R�(RâR�tallowed_domain((s!/usr/lib64/python2.7/cookielib.pytis_not_allowed�s cCsWtd|j|jƒx:d D]2}d|}t||ƒ}|||ƒstSqWtS( sØ 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). s - checking cookie %s=%sR“t verifiabilityRR‘R�R”tset_ok_(R“RRR‘R�R”(RRR€RðR˜R�(RâR÷R¹tntfn_nametfn((s!/usr/lib64/python2.7/cookielib.pyRø¥s  cCs{|jdkr)td|j|jƒtS|jdkrP|j rPtdƒtS|jdkrw|j rwtdƒtStS(Ns0 Set-Cookie2 without version attribute (%s=%s)is$ RFC 2965 cookies are switched offs$ Netscape cookies are switched off( R“RRRR€R˜RýRüR�(RâR÷R¹((s!/usr/lib64/python2.7/cookielib.pytset_ok_version¸s  cCsk|jƒrgt|ƒrg|jdkr>|jr>tdƒtS|jdkrg|jrgtdƒtSntS(Nis> third-party RFC 2965 cookie during unverifiable transactions> third-party Netscape cookie during unverifiable transaction(tis_unverifiableR×R“RRR˜RR�(RâR÷R¹((s!/usr/lib64/python2.7/cookielib.pytset_ok_verifiabilityÇs  cCsB|jdkr>|jr>|jjdƒr>td|jƒtStS(Nit$s' illegal name (starts with '$'): '%s'(R“RRRxRR˜R�(RâR÷R¹((s!/usr/lib64/python2.7/cookielib.pyt set_ok_nameÓs cCsp|jrlt|ƒ}|jdks<|jdkrl|jrl|j|j|ƒ rltd|j|ƒtSntS(Nis7 path attribute %s is not a prefix of request path %s( RÛRÅR“RRûR‘RR˜R�(RâR÷R¹treq_path((s!/usr/lib64/python2.7/cookielib.pyt set_ok_pathÜs   c Cs…|j|jƒr&td|jƒtS|j|jƒrLtd|jƒtS|jr�t|ƒ\}}|j}|jr|jdƒdkr|j dƒ}|j dd|ƒ}|dkr||d}||d|!} | j ƒd"krt |ƒdkrtd|ƒtSqn|j dƒr4|d} n|} | j dƒdk} | rs|dkrstd|ƒtS|jdkrÍ|j|ƒ rÍ|j dƒ rÍd|j|ƒ rÍtd||ƒtSn|jdksì|j|j@rt||ƒstd ||ƒtSn|jdks1|j|j@r�|t |ƒ } | j dƒdkr~tj|ƒ r~td!| |ƒtSq�ntS(#Ns" domain %s is in user block-lists& domain %s is not in user allow-listR©iiitcotactcomtedutorgtnettgovtmilRItaerotbiztcattcooptinfotjobstmobitmuseumRtprottravelteus& country-code second level domain %ss.locals/ non-local domain %s contains no embedded dotsO effective request-host %s (even with added initial dot) does not end with %ss5 effective request-host %s does not domain-match %ss. host prefix %s for domain %s contains a dot(RRRR R!R"R#R$RIR%R&R'R(R)R*R+R,RR-R.R/(R R�RR˜RRÙRÀRtcountR¬RQtlenRxR½R“R�RtDomainRFC2965MatchR°tDomainStrictNoDotsRªRHR�( RâR÷R¹R¿R¾R�R¯tjttldtsldtundotted_domaint embedded_dotst host_prefix((s!/usr/lib64/python2.7/cookielib.pyt set_ok_domainçsf           cCs±|jr­t|ƒ}|dkr*d}n t|ƒ}xt|jjdƒD]F}yt|ƒWntk r~td|ƒt SX||krIPqIqIWtd||jƒt Snt S(Nt80Rqs bad port %s (not numeric)s$ request port (%s) not found in %s( RØRÉRtstrR”RšRIRRRR˜R�(RâR÷R¹treq_portRì((s!/usr/lib64/python2.7/cookielib.pyt set_ok_port"s"         cCsWtd|j|jƒx:d D]2}d|}t||ƒ}|||ƒstSqWtS( sÛ 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). s - checking cookie %s=%sR“RR’R�R”R�t return_ok_(R“RR’R�R”R�(RRR€RðR˜R�(RâR÷R¹RRR((s!/usr/lib64/python2.7/cookielib.pyRù7s   cCsR|jdkr'|j r'tdƒtS|jdkrN|j rNtdƒtStS(Nis$ RFC 2965 cookies are switched offs$ Netscape cookies are switched off(R“RýRR˜RüR�(RâR÷R¹((s!/usr/lib64/python2.7/cookielib.pytreturn_ok_versionIs  cCsk|jƒrgt|ƒrg|jdkr>|jr>tdƒtS|jdkrg|jrgtdƒtSntS(Nis> third-party RFC 2965 cookie during unverifiable transactions> third-party Netscape cookie during unverifiable transaction(RR×R“RRR˜RR�(RâR÷R¹((s!/usr/lib64/python2.7/cookielib.pytreturn_ok_verifiabilityRs  cCs-|jr)|jƒdkr)tdƒtStS(Nthttpss( secure cookie with non-secure request(R’tget_typeRR˜R�(RâR÷R¹((s!/usr/lib64/python2.7/cookielib.pytreturn_ok_secure^s cCs$|j|jƒr tdƒtStS(Ns cookie expired(Rët_nowRR˜R�(RâR÷R¹((s!/usr/lib64/python2.7/cookielib.pytreturn_ok_expiresds cCsu|jrqt|ƒ}|dkr*d}nxD|jjdƒD]}||kr=Pq=q=Wtd||jƒtSntS(NR;Rqs0 request port %s does not match cookie port %s(R”RÉRRšRR˜R�(RâR÷R¹R=Rì((s!/usr/lib64/python2.7/cookielib.pytreturn_ok_portjs      cCsõt|ƒ\}}|j}|r>|jdƒ r>d|}n|}|jdkr‡|j|j@r‡|j r‡||kr‡tdƒtS|jdkrºt ||ƒ rºtd||ƒtS|jdkrñd|j |ƒ rñtd||ƒtSt S(NR©isQ cookie with unspecified domain does not string-compare equal to request domainsQ effective request-host name %s does not domain-match RFC 2965 cookie domain %ss; request-host %s does not match Netscape cookie domain %s( RÀR�RxR“RtDomainStrictNonDomainRÙRR˜R°R�R�(RâR÷R¹R¿R¾R�t dotdomain((s!/usr/lib64/python2.7/cookielib.pytreturn_ok_domainxs&    # cCsÙt|ƒ\}}|jdƒs.d|}n|jdƒsJd|}n|rm|jdƒ rmd|}n|}|j|ƒpŽ|j|ƒs•tS|j|ƒrµtd|ƒtS|j|ƒrÕtd|ƒtStS(NR©s" domain %s is in user block-lists& domain %s is not in user allow-list(RÀRxR�R˜R RRR�(RâR�R¹R¿R¾RI((s!/usr/lib64/python2.7/cookielib.pyRú“s"     cCs‚td|ƒt|ƒ}t|ƒ}||kr5tS|j|ƒrn|jdƒsj|||d!dkrntStd||ƒtS(Ns- checking cookie path=%sRÁis %s does not path-match %s(RRÅR1R�RxR�R˜(RâR‘R¹Rtpathlen((s!/usr/lib64/python2.7/cookielib.pyRû­s    &N("RóRôRõR3RHR2t DomainLiberalt DomainStrictRR�R˜RäR R R R RRRøRRRRR:R>RùR@RARDRFRGRJRúRû(((s!/usr/lib64/python2.7/cookielib.pyR\sL           ;       cCs&|jƒ}|jƒt|j|ƒS(N(tkeystsorttmapRæ(tadictRN((s!/usr/lib64/python2.7/cookielib.pytvals_sorted_by_keyºs  ccsvt|ƒ}xc|D][}t}y |jWntk r=n#Xt}xt|ƒD] }|VqQW|s|VqqWdS(sBIterates over nested mapping, depth-first, in sorted order by key.N(RRR˜titemstAttributeErrorR�t deepvalues(tmappingtvaluestobjtsubobj((s!/usr/lib64/python2.7/cookielib.pyRU¿s     tAbsentcBseZRS((RóRô(((s!/usr/lib64/python2.7/cookielib.pyRZÒscBs(eZdZejdƒZejdƒZejdƒZejdƒZejdƒZ dZ dd„Z d„Z d „Zd „Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zdddd„Zd„Zd„Zd„Zd„Zd„Zd„Z RS(sŽCollection of HTTP cookies. You may not need to know about this class: try urllib2.build_opener(HTTPCookieProcessor).open(url). s\Ws([\"\\])s\.?[^.]*s[^.]*s^\.+s^\#LWP-Cookies-(\d+\.\d+)cCs=|dkrtƒ}n||_tjƒ|_i|_dS(N(RRt_policyt _threadingtRLockt _cookies_lockt_cookies(Râtpolicy((s!/usr/lib64/python2.7/cookielib.pyRääs    cCs ||_dS(N(R[(RâR`((s!/usr/lib64/python2.7/cookielib.pyt set_policyìscCsÌg}|jj||ƒsgStd|ƒ|j|}xŒ|jƒD]~}|jj||ƒsgqFn||}xP|jƒD]B}|jj||ƒs©tdƒq~ntdƒ|j|ƒq~WqFW|S(Ns!Checking %s for cookies to returns not returning cookies it's a match( R[RúRR_RNRûRWRùRw(RâR�R¹tcookiestcookies_by_pathR‘tcookies_by_nameR÷((s!/usr/lib64/python2.7/cookielib.pyt_cookies_for_domainïs      cCs=g}x0|jjƒD]}|j|j||ƒƒqW|S(s2Return a list of cookies to be returned to server.(R_RNtextendRe(RâR¹RbR�((s!/usr/lib64/python2.7/cookielib.pyt_cookies_for_requestsc CsÈ|jdd„dtƒt}g}xœ|D]”}|j}|sjt}|dkrj|jd|ƒqjn|jdk rµ|jj|jƒrµ|dkrµ|j j d|jƒ}n |j}|jdkrà|j|j ƒn|jd|j |fƒ|dkr,|j r&|jd|j ƒn|jjd ƒr{|j}|j rg|jd ƒrg|d }n|jd |ƒn|jdk rÀd }|jr­|d |j}n|j|ƒqÀq,q,W|S(sÜ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). R¤cSs t|jƒS(N(R1R‘(targ((s!/usr/lib64/python2.7/cookielib.pytR]treverseis $Version=%ss\\\1s%s=%ss $Path="%s"R©is $Domain="%s"s$Ports="%s"N(ROR�R˜R“RwR€Rt non_word_reRHtquote_reRcRRÛR‘R�RxRÚR”RØ( RâRbR¡tattrsR÷R“R€R�Rì((s!/usr/lib64/python2.7/cookielib.pyt _cookie_attrss>    !       cCs tdƒ|jjƒzÕttjƒƒ|j_|_|j|ƒ}|j|ƒ}|r‹|j dƒs‹|j ddj |ƒƒq‹n|jj rë|jj rë|j dƒ rëx4|D])}|jdkr»|j ddƒPq»q»WnWd|jjƒX|jƒdS(s—Add correct Cookie: header to request (urllib2.Request object). The Cookie2 header is also added unless policy.hide_cookie2 is true. tadd_cookie_headerRs; tCookie2is $Version="1"N(RR^tacquireRIR8R[RERgRnt has_headertadd_unredirected_headerR…RýRÿR“treleasetclear_expired_cookies(RâR¹RbRmR÷((s!/usr/lib64/python2.7/cookielib.pyRoCs$   cCsg}d}d}x|D]ü}|d \}}t}t} i} i} x¦|d D]š\} } | jƒ}||ks‚||kr‹|} n| |kr¬| dkr¬t} n| | kr¾qRn| dkrù| dkrêtd ƒt} Pn| jƒ} n| dkr0|rqRn| dkr0tdƒqRq0n| dkr�t}yt| ƒ} Wn"tk rvtdƒt} PnXd} |j| } n| |ks¥| |krâ| dkrÕ| dkrÕtd| ƒt} Pn| | | s, (RwRñt __class__RóR…(RâtrR÷((s!/usr/lib64/python2.7/cookielib.pyRòÚs cCsGg}x!|D]}|jt|ƒƒq Wd|jjdj|ƒfS(Ns<%s[%s]>s, (RwR<RœRóR…(RâR�R÷((s!/usr/lib64/python2.7/cookielib.pyRïßs N(!RóRôRõRytcompileRkRltstrict_domain_ret domain_retdots_retmagic_reRRäRaReRgRnRoRR„R…R‡R’R”R“R˜R�R™RuRšR›RòRï(((s!/usr/lib64/python2.7/cookielib.pyRÔs8     ; ! a \ 6      cBseZRS((RóRô(((s!/usr/lib64/python2.7/cookielib.pyRæscBsVeZdZdedd„Zdeed„Zdeed„Zdeed„ZRS(s6CookieJar that can be loaded from and saved to a file.cCs]tj||ƒ|dk rAy |dWqAtdƒ‚qAXn||_t|ƒ|_dS(s} Cookies are NOT loaded from the named file until either the .load() or .revert() method is called. R]sfilename must be string-likeN(RRäRRRtfilenameR€t delayload(RâR£R¤R`((s!/usr/lib64/python2.7/cookielib.pyRäës   cCs tƒ‚dS(sSave cookies to a file.N(Rö(RâR£tignore_discardtignore_expires((s!/usr/lib64/python2.7/cookielib.pytsaveúscCsn|dkr6|jdk r'|j}q6ttƒ‚nt|ƒ}z|j||||ƒWd|jƒXdS(sLoad cookies from a file.N(RR£RRtMISSING_FILENAME_TEXTtopent _really_loadtclose(RâR£R¥R¦R((s!/usr/lib64/python2.7/cookielib.pytloadþs   cCs´|dkr6|jdk r'|j}q6ttƒ‚n|jjƒz\tj|jƒ}i|_y|j |||ƒWn#t t fk r�||_‚nXWd|jj ƒXdS(sÈClear all cookies and reload cookies from a saved file. Raises LoadError (or IOError) if reversion is not successful; the object's state will not be altered if this happens. N( RR£RRR¨R^RqRàtdeepcopyR_R¬RtIOErrorRt(RâR£R¥R¦t old_state((s!/usr/lib64/python2.7/cookielib.pytrevert s      N( RóRôRõRR˜RäR§R¬R°(((s!/usr/lib64/python2.7/cookielib.pyRès  (RR(R(XRõt__all__RyR¶RàR8RÎt threadingR\t ImportErrortdummy_threadingthttplibtcalendarR R˜R RR RR<t HTTP_PORTRÈR¨RRR$R=R>RORRwRQR<R@RFRžRGRNR\R^tIRbtXRdRgRhRjRpRrRsRuRtRƒR„R‹RŽR¨RªR«R°R±R³R¸R¼RÀRÅRÉRÐRÑRÊRÃRÕR×RRRRRRURZRR®RRt _LWPCookieJarRRt_MozillaCookieJarR(((s!/usr/lib64/python2.7/cookielib.pyts    <        "  5  8 !  U   D  '      # b!ÿ_  ÿÿ<