ZճcA dZdZdZgdZdZdZddlZddlZddlZddl Z ddl Z ddl m Z ddl Z ddl Z ddlZdd lmZddlZdd lmZdd lmZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl!Z!ddl"Z#ddl$Z$ ddl%Z%n#e&$r d d l'm%Z%YnwxYwd dl'm(Z(d dl)Td dl*m*Z*dZ+gdZ,dZ-dZ.dZ/gdZ0dZ1e2dZ3ddl4m5Z5e5j6Z7e8eddp e8edZ9 dRdZ:dZ;dZ<ej=dZ>dZ?d Z@ej=d!ZAej=d"ejBZCd#ZDej=d$ZEd%ZFd&ZGd'ZHdZId(ZJd)ZKd*ZLd+ZMd,ZNd-ZOGd.d/ePZQGd0d1eQZRGd2d3eQZSGd4d5eQZTGd6d7eQZUGd8d9eQZVeReUeSeTeVd:ZWgd;ZXGd<d=ePZYGd>d?ePZZGd@dAeZZ[GdBdCePZ\GdDdEePZ]dSdGZ^dTdHZ_GdIdJej`jaZbGdKdLej`jcZdebeddMZeGdNdOePZfGdPdQegZhdS)Uz+Small, fast HTTP client library for Python.z!Joe Gregorio (joe@bitworking.org)zCopyright 2006, Joe Gregorio) !Thomas Broyer (t.broyer@ltgt.net)z James AntillzXavier Verges FarrerozJonathan Feinbergz Blair ZajaczSam RubyzLouis Nyffeneggerz Mark PilgrimzAlex YuMITz0.20.4N)header)gettext)md5)sha1)socks)auth)*)iri2uricXttdr|duo |tjuS|duS)N_GLOBAL_DEFAULT_TIMEOUT)hasattrsocketr)timeouts 3/usr/lib/python3/dist-packages/httplib2/__init__.py has_timeoutr9s9v011Ud"Twf6T'TT $ ) debuglevelFailedToDecompressContentHttp HttpLib2Error ProxyInfo RedirectLimitRedirectMissingLocationResponseRETRIES"UnimplementedDigestAuthOptionError&UnimplementedHmacDigestAuthOptionError) connectionz keep-alivezproxy-authenticatezproxy-authorizationtetrailerstransfer-encodingupgrade)GETHEADOPTIONSTRACE),-./i34)certs PROTOCOL_TLSPROTOCOL_SSLv23cttdstdtjt}|r tjn tj|_|Vt|dr7t|trttj |}||_ ntd|Vt|dr7t|trttj |}||_ ntdt|dr| |_|||r|||||S)N SSLContextz0httplib2 requires Python 3.2+ for ssl.SSLContextmaximum_versionzHsetting tls_maximum_version requires Python 3.7 and OpenSSL 1.1 or newerminimum_versionzHsetting tls_minimum_version requires Python 3.7 and OpenSSL 1.1 or newercheck_hostname)rssl RuntimeErrorr5DEFAULT_TLS_VERSION CERT_NONE CERT_REQUIRED verify_mode isinstancestrgetattr TLSVersionr6r7r8load_verify_locationsload_cert_chain)"disable_ssl_certificate_validationca_certs cert_filekey_filer6r7 key_passwordcontexts r_build_ssl_contextrKsZ 3 % %OMNNNn011G+Md#--SVSdG" 7- . . k/3// K")#./"J"J&5G # #ijj j" 7- . . k/3// K")#./"J"J&5G # #ijj jw())H%G!G !!(+++C 8\BBB Nrcttd|dddDfdt|DS)Nc6g|]}|Sstrip.0xs r z(_get_end2end_headers..s RRR1QWWYYRRRrr#,cg|]}|v| SrNrN)rRrhopbyhops rrTz(_get_end2end_headers..s# Q Q Qv&:P:PF:P:P:Pr)list HOP_BY_HOPextendgetsplitkeys)responserXs @r_get_end2end_headersr`swJH OORR \2(F(F(L(LS(Q(QRRRSSS Q Q Q Qhmmoo!6!6 Q Q QQrc\t|jdkr>t|jdtjr|jdjn|jSt |drE|j}t|jdtjr|jdjn|jSdS)Nr socket_err)lenargsr?rerrorerrnorrb)ee_ints r_errno_from_exceptionris 16{{Q",QVAY "E"ERqvay17Rq,_ &0A &M&M^uz!}""SXS^^ 4rz9^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?ct|}|d|d|d|d|dfS)zParses a URI using the regex given in Appendix B of RFC 3986. (scheme, authority, path, query, fragment) = parse_uri(uri) r )URImatchgroups)urirqs r parse_urirssD YYs^^ " " $ $F 1Ivay&)VAYq BBrc0t|\}}}}}|r|std|z|}|}|sd}|rd||gp|}|}|dz|z|z}||||fS)Nz(Only absolute URIs are allowed. uri = %s/?z://)rsRelativeURIErrorlowerjoin)rrscheme authoritypathqueryfragment request_uri defrag_uris rurlnormrs1:3.VYeX QQICOPPP!!I \\^^F 3CHHdE]33;tK \\^^F%)+k9J 9k: 55rz^\w+://z[^\w\-_.()=!]+cvt|tr|}|d}n|d}t |}t d|}td|}|dd}d ||fS)zReturn a filename suitable for the cache. Strips dangerous and common characters to create a filename we can use to store the cache in. utf-8rUNZrV) r?bytesdecodeencode_md5 hexdigest re_url_schemesub re_unsafery)filenamefilename_bytesfilemd5s rsafenamers (E""2!??7++!11>"",,..G  X..H}}R**H}H 88Xw' ( ((rz(?:\r\n)?[ \t]+cXtd|DS)Ncg|]`\}}t|tt|dfaS) )_convert_byte_strrxNORMALIZE_SPACErrP)rRkeyvalues rrTz&_normalize_headers..sl   es # # ) ) + +_-@-@ARSXAYAY[^-_-_-e-e-g-g i   r)dictitems)headerss r_normalize_headersrs8   '      rcPt|tst|dS|SNr)r?r@)ss rrr s' a  1g Hrci}d|vrE|dd}d|D}d|D}t||z}|S)N cache-controlrVc g|]H}d|dktd|ddDIS)=cZg|](}|)SrN)rPrxrQs rrTz3_parse_cache_control...s*AAA17799??$$AAArr )findtupler])rRparts rrTz(_parse_cache_control..s_   GKXZ^b^g^ghk^l^lXlXlEAAdjja.@.@AAA B BXlXlXlrcg|]C}d|dk|dfDS)rrr )rrPrx)rRnames rrTz(_parse_cache_control..sF]]]tdiiX[nnH\H\$**,,,,..2H\H\H\r)r]r)rretvalpartsparts_with_args parts_wo_argss r_parse_cache_controlrsu F'!!(..s33  OT   ^]u]]] o 566 Mrcd}t|}t|}d|vr>|dddkr d}d|vrd|d<nhd|vrd}n`d|vrd}nXd|vrd}nPd |vrKtjt j|d }tj}td ||z }d |vr) t|d }nl#t$rd }Yn^wxYwd |vrTt j|d } d | krd }n(td tj| |z }nd }d |vr) t|d }n#t$rd }YnwxYwd|vr. t|d} n#t$rd } YnwxYw|| z }||krd}|S)aDetermine freshness from the Date, Expires and Cache-Control headers. We don't handle the following: 1. Cache-Control: max-stale 2. Age: headers are not used in the calculations. Not that this algorithm is simpler than you might think because we are operating as a private (non-shared) cache. This lets us ignore 's-maxage'. We can also ignore 'proxy-invalidate' since we aren't a proxy. We will never return a stale document as fresh as a design decision, and thus the non-implementation of 'max-stale'. This also lets us safely ignore 'must-revalidate' since we operate as if every server has sent 'must-revalidate'. Since we are private we get to ignore both 'public' and 'private' parameters. We also ignore 'no-transform' since we don't do any transformations. The 'no-store' parameter is handled at a higher level. So the only Cache-Control parameters we look at are: no-cache only-if-cached max-age min-fresh STALEpragmazno-cacher TRANSPARENTronly-if-cachedFRESHdaterzmax-ageexpiresNz min-fresh) rrxrcalendartimegmemailutils parsedate_tztimemaxint ValueError) response_headersrequest_headersrcc cc_responsernow current_agefreshness_lifetimer min_freshs r_entry_dispositionr&sW8F o . .B&'788K?""x'@'F'F'H'H'M'Mj'Y'Y]_'_'_ / 1 1/9OO , r   { " " R   # # #u{778H8PQQRRikk!S4Z((  # # '%(Y)?%@%@"" ' ' '%&""" ' * * *k../? /JKKGw%&""%(HOG,D,Dt,K%L%L""!"  ?? '%(I%7%7"" ' ' '%&""" ' "   ;00       9 $K  + +F Ms6"C88 DD)E?? F FF,, F;:F;c|} |dd}|dvr|dkr9tjtj|}|dkr t j|t j }tt||d<|d|d<|d=nP#tt j f$r7d}ttd |dz||wxYw|S) Ncontent-encoding)gzipdeflater)fileobjrcontent-lengthz-content-encodingrUzDContent purported to be compressed with %s but failed to decompress.)r\rGzipFileioBytesIOreadzlib decompress MAX_WBITSr@rcIOErrorrer_)r_ new_contentcontentencodings r_decompressContentrqsG << 2D99 * * *6!!- ;0G0GHHHMMOO9$$/'DN?CC),S\\):):H% &,45G,HH( )+, TZ    ' T U UX`XdXdewXxXx x       Ns B,B11A C>cfd}|S)NcD]\}}td|zd|jt|tjr0t||j|jit j||jd|}t||jt|jdS)Nz%s:r)endfile) maxlinelen)rr)rcharset header_name)rprint_fpr?rHeaderr _maxheaderlen)selfhvrmsgs r_write_headersz+_bind_write_headers.._write_headerssIIKK 7 7DAq %!)48 4 4 4 4!V]++ 7ahh$*.s*"["["[A<0@A0F0F#G"["["[rr)rrctimerangerr)digs r_cnoncersi JLLLL"["[QVWYQZQZ"["["["[ \ddelmm  ikk ss8Orctjt|||ddSr)base64 b64encode_shardigestrPr)cnonceiso_nowpasswords r_wsse_username_tokenrs_6677HHEMMgVVWW^^``aaggiippqxyyrcVeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd S)Authenticationcht|\}} } } } | |_||_||_||_dSN)rsr|host credentialshttp) rr!r rrr_rr"rzr{r|r}r~s r__init__zAuthentication.__init__s;5>{5K5K2D%  & rct|\}}}}}|t|jddS)Nru)rsrcr|count)rrrzr{r|r}r~s rdepthzAuthentication.depthsA5>{5K5K2D%3ty>>++,223777rcvt|\}}}}}||jko||jSr)rsr  startswithr|)rr rrzr{r|r}r~s rinscopezAuthentication.inscopes:5>{5K5K2D% !Atty'A'AArcdS)znModify the request headers to add the appropriate Authorization header. Over-rise this in sub-classes.NrNrmethodrrrs rrequestzAuthentication.requests  rcdS)a Gives us a chance to update with new nonces or such returned from the last authorized response. Over-rise this in sub-classes if necessary. Return TRUE is the request is to be retried, for example Digest may return stale=true. FrN)rr_rs rr_zAuthentication.responses urcdSNFrNrr s r__eq__zAuthentication.__eq__urcdSNTrNr1s r__ne__zAuthentication.__ne__trcdSr5rNr1s r__lt__zAuthentication.__lt__r7rcdSr0rNr1s r__gt__zAuthentication.__gt__r3rcdSr5rNr1s r__le__zAuthentication.__le__r7rcdSr0rNr1s r__ge__zAuthentication.__ge__r3rcdSr5rNrs r__bool__zAuthentication.__bool__ r7rN)__name__ __module__ __qualname__r#r&r)r-r_r2r6r9r;r=r?rBrNrrrrs888BBB    rrceZdZdZdZdS)BasicAuthenticationc Ht||||||||dSrrr#rr!r rrr_rr"s rr#zBasicAuthentication.__init__,k4gxY`bfgggggrcdtjd|jzddz|d<dS)OModify the request headers to add the appropriate Authorization header.zBasic z%s:%sr authorizationN)rrr!rrPrr+s rr-zBasicAuthentication.requestsT$,f.> t' ' / / 8 8/ / %''&&//$"   rNrCrDrEr#r-rNrrrGrGs5hhh"""""rrGc&eZdZdZdZddZdZdS)DigestAuthenticationzMOnly do qop='auth' and MD5, since that is all Apache currently implementsc t||||||||tj|dd|_|jdd}dd|Dvrdpd|jd<|jdttd|z|jdd |jd<|jddkr*ttd |jdzd |j d d |jd d |j dg|_ d|jd<dS)Nwww-authenticaterqopr c6g|]}|SrNrOrQs rrTz1DigestAuthentication.__init__..#s +K+K+K!AGGII+K+K+KrzUnsupported value for qop: %s. algorithmMD5$Unsupported value for algorithm: %s.rUrrrealmr nc) rr#r _parse_www_authenticate challenger\r]rrupperryr!A1) rr!r rrr_rr"rTs rr#zDigestAuthentication.__init__sgk4gxY`bfggg5h@RSST\]n  //!'+K+Ksyy{{+K+K+K!K WQW _[_u >% (4Q7WZ]7]5^5^__ _&*n&8&8e&L&L&R&R&T&T{# >+ &% / /484>+;VVWW ''4+A.T^G5LcSWScdeSfhii trNc d fd}d|d|g}|p t|jd<d| |j|jddd|jd zd|jdd|jd d | z}d |jd |jd |jd||jd||jd |jd |jdf z|d<|jdr|dxxd|jdzz cc<|jd xxdz cc<dS)Modify the request headerscjt|dSr)rrr)rSs rz.DigestAuthentication.request..0s&d188G,,--7799rc$|d|S)NrrN)rdHs rrbz.DigestAuthentication.request..1s!!qqq!!,--rrUrrz"%s"noncez%08xrZrTzoDigest username="%s", realm="%s", nonce="%s", uri="%s", algorithm=%s, response=%s, qop=%s, nc=%08x, cnonce="%s"rrYrVrNopaquez , opaque="%s"r N)ryrr\r^r!r\) rr,rrrrKDA2request_digestres @rr-zDigestAuthentication.request.s 9 9 - - - - WWfc;/ 0 0#)#6WYYx "" AdgJJw'''----x(((u%%%"   # #   #  Q  N7 # N7 #  N; '  N5 ! N4 N8 $ $   >  h ' ' S O $ $ $$.:R(R R $ $ $ t!rc2d|vr_tj|ddi}d|dkr|d|jd<d|jd<d Sn3tj|d}d |vr|d |jd<d|jd<d S) Nzauthentication-inforSrtruestalerfr rZT nextnonceF)r r[r\r\_parse_authentication_info)rr_rr\updated_challenges rr_zDigestAuthentication.responseRs  0 04X?QRRVVW_acddIw////*3G*<w''(t$t0 !% ?J_ ` ` ///*;K*Hw''(t$urr)rCrDrE__doc__r#r-r_rNrrrQrQsQ** ! ! !""""""""H     rrQc(eZdZdZdZdZdZdZdS)HmacDigestAuthenticationz@Adapted from Robert Sayre's code and DigestAuthentication above.rc t||||||||tj|d}|d|_|jdd|jd<|jddvr d|jd<|jdd|jd<|jdst td |jd d |jd <|jd d vr*t td |jd z|jdd|jd<|jddvr*t td|jdz|jd dkr t|_ n t|_ |jddkr t|_ n t|_ d |j dd|j d |j d|jdgd|jdg|_|j |j|_dS)NrS hmacdigestreason unauthorized)rw integritysaltrUsnoncezCThe challenge doesn't contain a server nonce, or this one is empty.rV HMAC-SHA-1)r{HMAC-MD5rXz pw-algorithmSHA-1)r}rWz'Unsupported value for pw-algorithm: %s.r|rWrrr rY)rr#r r[r\r\r rrhashmodr pwhashmodryr!newrrxr) rr!r rrr_rr"r\s rr#z!HmacDigestAuthentication.__init__gsk4gxY`bfggg0;MNN "<0#'>#5#5h#O#Ox >( #+H H H'5DN8 $!%!3!3FB!?!?v~!!(++ 8WXX '+n&8&8l&S&S{# >+ &.H H H884>+;VVWW *.););NG)T)T~& >. )1A A A8;dn^>\\]]  >+ &* 4 4DLLDL >. )U 2 2!DNN!DN77 #""277D,%%dh//99;;AACCrcJt}dd|D}dfd|D}tjdtj}t } |d|d| d|jdd| } tj|j | |j  } d|j dd |jd d |jdd | d |d|d| d|dd<dS)r`rUcg|]}d|zS)z%s rN)rRks rrTz4HmacDigestAuthentication.request..s333519333rc g|] }| SrNrN)rRrrs rrTz4HmacDigestAuthentication.request..s888awqz888r%Y-%m-%dT%H:%M:%SZrrzzHMACDigest username="rz ", realm="rYz ", snonce="z ", cnonce="z", uri="z ", created="z ", response="z ", headers=""rNN)r`ryrstrftimegmtimerr\hmacrrr~rrxr!) rr,rrrr^keylist headers_valcreatedrrjs ` rr-z HmacDigestAuthentication.requests>#G,,''33d33344gg8888488899 - 4dkmmDD-3VV[[[&&&$.YaJbJbJbdodoq$(NDLIISSUU[[]]  Q    N7 # # # N8 $ $ $ FF KK GG NN GG $    rctj|ddi}|ddvrdSdS)NrSrurv)rxrmTF)r r[r\)rr_rr\s rr_z!HmacDigestAuthentication.responsesI0;MNNRRS_acdd == " "&< < <4urN)rCrDrErq __author__r#r-r_rNrrrsrsbsPJJ4J(D(D(DT   0rrsceZdZdZdZdZdS)WsseAuthenticationaThis is thinly tested and should not be relied upon. At this time there isn't any third party server to test against. Blogger and TypePad implemented this algorithm at one point but Blogger has since switched to Basic over HTTPS and TypePad has implemented it wrong, by never issuing a 401 challenge but instead requiring your client to telepathically know that their endpoint is expecting WSSE profile="UsernameToken".c Ht||||||||dSrrIrJs rr#zWsseAuthentication.__init__rKrc d|d<tjdtj}t}t |||jd}d|jdd|d|d |d |d <d S) rMzWSSE profile="UsernameToken"rNrr zUsernameToken Username="rz", PasswordDigest="z ", Nonce="z ", Created="rzX-WSSEN)rrrrrr!)rr,rrrrrpassword_digests rr-zWsseAuthentication.requests$B - 4dkmmDD.vw@PQR@STT  Q    OO FF GG  rN)rCrDrErqr#r-rNrrrrsAAAhhh      rrceZdZdZdZdS)GoogleLoginAuthenticationc 0ddlm}t||||||||| j|d} | ddd} | dkr|ddkrd} t|d|d | |d  } |j d d || ddi\} }| d} td| D}| j dkr d|_ dS|d|_ dS)Nr) urlencoderS googleloginservicexapirclr user-agent)EmailPasswdrsourcez+https://www.google.com/accounts/ClientLoginPOSTz Content-Typez!application/x-www-form-urlencoded)r,bodyr cXg|]'}|t|dd(S)rr )rr])rRlines rrTz6GoogleLoginAuthentication.__init__..s3FFFF% 3**++FFFrirUAuth) urllib.parserrr#r[r\rrr"r-r]rr)rr!r rrr_rr"rr r\rresplinesrds rr#z"GoogleLoginAuthentication.__init__sH******k4gxY`bfggg0D0;MNN M*..y&AA f  !1!1*!=!=!A!AG +a.QY`amYnppp )) 94#%HI *  g  d## FFFFF G G ;#  DIII& DIIIrc d|jz|d<dS)rMzGoogleLogin Auth=rNN)rr+s rr-z!GoogleLoginAuthentication.requests$7#B   rNrOrNrrrrs7"""8CCCCCrr)basicwsserrur)rurrrrc.eZdZdZefdZdZdZdZdS) FileCachezUses a local directory as a store for cached files. Not really safe to use if multiple threads or processes are going to be running on the same cache. c||_||_tj|stj|jdSdSr)rsafeosr|existsmakedirs)rrrs rr#zFileCache.__init__sH  w~~e$$ $ K # # # # # $ $rcd}tj|j||} t |d}|}|n#t$rYnwxYw|S)Nrb) rr|ryrropenrcloser)rrr cacheFullPathfs rr\z FileCache.gets} TZ3@@  ]D))AVVXXF GGIIII    D  s8A55 BBctj|j||}t |d}|||dS)Nwb)rr|ryrrrwriter)rrrrrs rrz FileCache.setsR TZ3@@  % %   rctj|j||}tj|rtj|dSdSr)rr|ryrrrremove)rrrs rrzFileCache.deletesY TZ3@@ 7>>- ( ( % Im $ $ $ $ $ % %rN) rCrDrErqrr#r\rrrNrrrrsd $,$$$$    %%%%%rrc(eZdZdZddZdZdZdS) Credentialscg|_dSrr!rAs rr#zCredentials.__init__rrUcd|j|||fdSrr!appendrxrrrdomains raddzCredentials.add s. x @AAAAArcg|_dSrrrAs rclearzCredentials.clear#rrc#JK|jD]\}}}|dks||kr||fVdSNrUr)rrcdomainrrs riterzCredentials.iter&sN)-)9 ' ' %WdH"}}' 1 1X&&&& ' 'rNrU)rCrDrEr#rrrrNrrrrsYBBBB'''''rrceZdZdZdZdZdS)KeyCertszNIdentical to Credentials except that name/password are mapped to key/cert.cf|j||||fdSrrrrcertrrs rrz KeyCerts.add0s0 dH EFFFFFrc#NK|jD]\}}}}|dks||kr|||fVdSrr)rrrrrrs rrz KeyCerts.iter3sR.2.> , , *Wc4"}}' 1 1D(++++ , ,rN)rCrDrErqrrrNrrrr,s?--GGG,,,,,rrceZdZdS)AllHostsN)rCrDrErNrrrr9sDrrc>eZdZdZdZ d dZdZdZdZd Z d Z dS) rz,Collect information required to use a proxy.rNTNct|tr|}t|tr|}|||||||f\|_|_|_|_|_|_|_ dS)aArgs: proxy_type: The type of proxy server. This must be set to one of socks.PROXY_TYPE_XXX constants. For example: p = ProxyInfo(proxy_type=socks.PROXY_TYPE_HTTP, proxy_host='localhost', proxy_port=8000) proxy_host: The hostname or IP address of the proxy server. proxy_port: The port that the proxy server is running on. proxy_rdns: If True (default), DNS queries will not be performed locally, and instead, handed to the proxy to resolve. This is useful if the network does not allow resolution of non-local names. In httplib2 0.9 and earlier, this defaulted to False. proxy_user: The username used to authenticate with the proxy server. proxy_pass: The password used to authenticate with the proxy server. proxy_headers: Additional or modified headers for the proxy connect request. N) r?rr proxy_type proxy_host proxy_port proxy_rdns proxy_user proxy_pass proxy_headers)rrrrrrrrs rr#zProxyInfo.__init__Bs( j% ( ( -#**,,J j% ( ( -#**,,J         O O O O O O    rcZ|j|j|j|j|j|j|jfSr)rrrrrrrrAs rastuplezProxyInfo.astuplels0 O O O O O O    rc<to|jdko |jdkSr)r rrrAs risgoodzProxyInfo.isgoodws P$/T1P48OPrc.|| Sr) bypass_host)rhostnames r applies_tozProxyInfo.applies_tozs##H----rc|jturdSd|dz}|jD];}|dr||rdS|d|zkrdS->y-I-I tt3?**tt+urc.d|S)Nz)p)formatrAs r__repr__zProxyInfo.__repr__s @ &4&..  r)TNNN) rCrDrErqrr#rrrrrrNrrrr=s66Ltx( ( ( ( T    QQQ...   rrr"c|dvrdS|dz}tj|tj|}|sdSt ||dS)z4Read proxy info from the environment variables. r"httpsN_proxy)noproxy)renvironr\r]proxy_info_from_url)r,env_varurls rproxy_info_from_environmentrsl&&&xG *.."*.."A"A B BC  sFD 9 9 99rctj|}d}t||j|jpt dd||jpd|jpdd}g}|>tj dtj dd }|d krt}nK| r7|d }tt!t"|}||_|S) zBConstruct a ProxyInfo from a URL (such as http_proxy env var) rkiP)rr"N)rrrrrrno_proxyNO_PROXYrUr rV)urllibparseurlparserrportrusernamerrrr\rrPr]rfilterboolr)rr,rrpirs rrrs ,   $ $CJ <8?t#B777?<'4<'4    BL*..RZ^^J-K-KLL#~~ 9}}S)) VD,7788 "BO Irc eZdZdZddZdZdS)HTTPConnectionWithTimeoutagHTTPConnection subclass that supports timeouts HTTPConnection subclass that supports timeouts All timeouts are in seconds. If None is passed for timeout then Python's default timeout for sockets will be used. See for example the docs of socket.setdefaulttimeout(): http://docs.python.org/library/socket.html#socket.setdefaulttimeout Nctjj||||||_|r't |t s|d|_dSdSdS)N)rrr")r"clientHTTPConnectionr# proxy_infor?r)rr rrrs rr#z"HTTPConnectionWithTimeout.__init__sm "++D$T7+SSS$  1jY?? 1(j00DOOO 1 1 1 1rc|jrttd|jr`|jrG|j|jr(d}|j\}}}}}}}|} |} nd}|j} |j} d}d} tj | | dtj D]} | \} }}}} |r;tj | |||_ |j ||||||nKtj| |||_ |j tjtjdt#|jr|j |j|jdkrdt+d|j|j|r5t+dt/||||||f|j |j|jf|d dzn#tj$r}|} |jdkrdt+d |j|j|r5t+d t/||||||f|j r|j d|_ Yd}~d}~wwxYw|j s| dS) z3Connect to the host and port specified in __init__.Nz2Proxy support missing but proxy use was requested!TFrr z connect: ({0}, {1}) ************zproxy: {0} ************r!connect fail: ({0}, {1}) proxy: {0})rr ProxiesUnavailableErrorrrr rrr getaddrinfo SOCK_STREAM socksocketsocksetproxy setsockopt IPPROTO_TCP TCP_NODELAYrr settimeoutrrrr@connectrer)r use_proxyrrrrrrrr rrbresafsocktypeproto canonnamesargs rrz!HTTPConnectionWithTimeout.connects1 ? `u})*^__ _ ? t5577 DOeZdZdZ dfd ZdZxZS)HTTPSConnectionWithTimeouta-This class allows communication via SSL. All timeouts are in seconds. If None is passed for timeout then Python's default timeout for sockets will be used. See for example the docs of socket.setdefaulttimeout(): http://docs.python.org/library/socket.html#socket.setdefaulttimeout NFc T||_|r|nt|_||_|r%t |t s|d|_t |j|j||| | | } tt| |||| ||_ ||_ | |_ dS)Nr)r6r7rI)rrrJ) rECA_CERTSrFrr?rrKsuperr%r#rHrGrI)rr rrHrGrrrFrEtls_maximum_versiontls_minimum_versionrIrJ __class__s rr#z#HTTPSConnectionWithTimeout.__init__s3U/$,:( $  2jY?? 2(j11DO$  3 M  //%    ($//88 tWg 9   ! "(rc|jr`|jrG|j|jr(d}|j\}}}}}}}|} |} nd}|j} |j} d}d}d} t j| | dt j} | D]*\} }}}} |r1tj | ||}| ||||||nAt j| ||}| t j t jdt|jr||j||j|jf|j||j|_t-|jds|js t1j|j|jnL#t6$r?|jt j|jwxYw|jdkrdtAd!|j|j|r5tAd !tE||||||fn,#t0j#t0j$f$rC}|r||jr|jd|_d}~wt jt j%f$rt j&$r}|} |jdkrdtAd !|j|j|r5tAd !tE||||||f|jr|jd|_Yd}~#d}~wwxYw|js| dS) z(Connect to a host on a given (SSL) port.TFNrr )server_hostnamer8zconnect: ({0}, {1})rr)'rrrr rrrrrr rrrrrrrrr_context wrap_socketrrrEr9match_hostname getpeercert Exceptionshutdown SHUT_RDWRrrrrr@SSLErrorCertificateErrorgaierrorre)rrrrrrrrrr rrb address_infofamilyr r!r"sockaddrrrgs rrz"HTTPSConnectionWithTimeout.connectEs" ? !t5577 !DO??Ho*49+@+@+B+BDINNNN$ **6+;<<< ))) ?Q&&/66ty$)LLMMM (// #ZZU_an$p q q L#"67   !JJLLL9&IOO%%%  NFO4   <    ?Q&&4;;DItyQQRRR (// #ZZU_an$p q q 9&IOO%%%    y    s@+DJ 11G#"J #A H,,A2J  O ;>K99-O &BOO ) NNNNNNFNNN)rCrDrErqr#r __classcell__)r+s@rr%r%s~+0  $)$)$)$)$)$)LVVVVVVVrr%rczeZdZdZddeddddfdZdZdZdZdZ dd Z dd Z d Z d Z dZdZdddedfdZdS)rzAn HTTP client that handles: - all methods - caching - ETags - compression, - HTTPS - Basic - Digest - WSSE and more. NFc||_||_||_||_||_i|_|r*t |trt||_ n||_ t|_ t|_ g|_d|_t |_ddg|_t't(|_d|_d|_d|_||_d|_dS)aIf 'cache' is a string then it is used as a directory name for a disk cache. Otherwise it must be an object that supports the same interface as FileCache. All timeouts are in seconds. If None is passed for timeout then Python's default timeout for sockets will be used. See for example the docs of socket.setdefaulttimeout(): http://docs.python.org/library/socket.html#socket.setdefaulttimeout `proxy_info` may be: - a callable that takes the http scheme ('http' or 'https') and returns a ProxyInfo instance per request. By default, uses proxy_info_from_environment. - a ProxyInfo instance (static proxy config). - None (proxy disabled). ca_certs is the path of a file containing root CA certificates for SSL server certificate validation. By default, a CA cert file bundled with httplib2 is used. If disable_ssl_certificate_validation is true, SSL cert validation will not be performed. tls_maximum_version / tls_minimum_version require Python 3.7+ / OpenSSL 1.1.0g+. A value of "TLSv1_3" requires OpenSSL 1.1.1+. TPUTPATCHFN)rrFrEr)r* connectionsr?r@rrrr!r certificatesauthorizationsfollow_redirectsREDIRECT_CODESredirect_codesoptimistic_concurrency_methodsrY SAFE_METHODS safe_methodsfollow_all_redirects ignore_etagforce_exception_to_status_coderforward_authorization_headers)rrrrrFrEr)r*s rr#z Http.__init__sH%  2T/#6 #6   Zs++ "5))DJJDJ'==%JJ!!%,05g.>+ ..%*! .3+ .3***rc|jic}|_|D]\}}||j|dS)zClose persistent connections, clear sensitive data. Not thread-safe, requires external synchronization against concurrent requests. N)r@rrrArclear_credentials)rexistingrcs rrz Http.closeso&*%5r"$"NN$$  DAq GGIIII !!!      rcTtj|j}d|vr|d=d|vr|d=|S)Nr-r@)copy__dict__)r state_dicts r __getstate__zHttp.__getstate__sAYt}--   " "9% J & &=)rcH|j|i|_dSr)rSupdater@)rstates r __setstate__zHttp.__setstate__s& U###rc #Ktj|d}|j|D]-}tD]#}||vrt ||||||||V$.dS)zcA generator that creates Authorization objects that can be applied to requests. rSN)r r[r!rAUTH_SCHEME_ORDERAUTH_SCHEME_CLASSES) rr rrr_r challengescredrzs r_auth_from_challengezHttp._auth_from_challenges1(|j|||dS)z]Add a name and password that will be used any time a request requires authentication.N)r!rrs radd_credentialszHttp.add_credentials(s% T8V44444rc@|j||||dS)zXAdd a key and cert that will be used any time a request requires authentication.N)rArrs radd_certificatezHttp.add_certificate-s' c4:::::rcF|jg|_dS)zKRemove all the names and passwords that are used for authenticationN)r!rrBrAs rrNzHttp.clear_credentials2s'     rcd}d}|tkr|dz } |j||||||nP#tj$r|tj$r,|td|j ztj $r?}t|} | tj tjfvr|tkrYd}~d}~wtjj$r|jN|tdz kr+||YC||tdz kr+||YYnwxYw |} d} |dkr|n| } t)| } |dkrt+| | } n#tjjtjjf$rM|s5|dkr/d}d}||Y_|tj$rtj tjjf$rG||dkr+||YwxYw | | fS)NrFr zUnable to find the server at %srr)T)rrrr-rrrr7ServerNotFoundErrorr rerirf ENETUNREACH EADDRNOTAVAILr"r  HTTPException getresponserrr BadStatusLineResponseNotReady) rconnrr,rrr seen_bad_status_linergerrno_r_rs r _conn_requestzHttp._conn_request8s $'kk FA 9$LLNNN V[$@@@@>    ? Y Y Y )*Kdi*WXXX<   .q11e/1DEEE!g++HHHH;,   9$7Q;    w{??JJLLLLLNNNH  ! D++--2V##JJLLLL&mmooG#H--V##07CCG?K-t{/KL   ,QA+/(JJLLLLLNNNHJJLLL>   L$+";<    66JJLLLLLNNNH $ '""sF3A A+F74C10C11AFA FFHAK.$BK.,K.c fd|jD} | rt| ddpd} | r| j||||||||\} } | rG| j| |r6| j||||||||\} } d| _| jdkr||| | D]s}|||||||||\} } | jdkr2|j||| |nt|j s||j vs | jdvr|j ra| j|j vrR|r>d| vr)| jdkrttd | | d| vrF| d}t|\}}}}}|dkr#t j||| d<| jd ks| jd kr5||j vr,| d| d <d | vr|| d <t'|| | |j| d|vr|d=d|vr|d=d|vr |js|d=d| vr[| d}t-j| }d |vr||d <|}| jdvrd}d}||||||dz \} } || _nDt3d| | | jdvr*||j vr!d | vr|| d <t'|| | |j| | | fS)zmDo the actual request using the connection object and also follow one level of redirects if necessarycVg|]%}|j|j|f&SrN)r)r&)rRr r rs rrTz!Http._request..sBtttTT`TXT`aegrTsTst*$*[))40tttrrr Ni)r/r0locationr,z:Redirected but the response is missing a Location: header.r0r--x-permanent-redirect-urlzcontent-location if-none-matchif-modified-sincerN)r.r/r()r,rr redirections4Redirected more times than redirection_limit allows.)r)rBsortedr-rpr_ _stale_digestrr_rrIrHrCrErrrsrrurljoinrrrLrRdeepcopypreviousr)rrmr  absolute_urirr,rrrwrauthsr r_rrNrsrzr{r|r}r~ old_responseredirect_methods ` ` r_requestz Http._requests! uttttT=Pttt,q)!,4  = DLgt < < <"00{FDRYZZ7  +t}Xt,, + V['4@@@&*&8&8{FTXZa&b&b#7)*& ?c ! !!%!:!:4gW_ah!i!i   %%fk7DIII&*&8&8{FTXZa&b&b#7?c))'..}===!**8T:::E*  $/ O$2C(C(CxZdGdGd$. OD'> -\AA?KL);<*0#?j88.3O#'D.2ll$_4QXgsvwgw/;//+7-9)'NPXZaJ..6T=N3N3N%X553?H/0WhXNNN'""rc t|Sr)r)rrs rrzHttp._normalize_headerss!'***rr(c d} |i}n||}d|vr dtz|d<t|}|ddddd d }t |\}} } } |d z| z}|j|} | &|s t|}t|j | } t|tr| rb|| | d d | d d |j |j|j|j|j|j| d d x} |j|<n]|| |j |j|j|j|j|jx} |j|<n"|| |j |jx} |j|<| t(d|vr d|vrd|d<t*j}d}d}|jr| }|j|}|r |dd \}}t+j|}|D]o\}}|drU|dr@||t?t*j !|d pn5#tDtFf$r!|j$|d}d}YnwxYw||j%vr!|jrd|vr|j&sd|vr |d|d<|jr%|r#||j'vr|j$|||j'vrwd|vrs|d}|(ddd}|D]-}d|z}||}||d|krd}n.|jr|r||j'vs |ddkrd|vr|}|ddvrd }d!|vr]|d krtSd"id|*|d!|||d z #\}}tW||_,d$|j,_-nt]||}|d%krtW|}d$|_-||fS|d&kr.d|vr|j&sd'|vr |d|d'<d(|vrd(|vr |d(|d)<n|d*kr |/| | || ||||| \}}|j0d+krw|d krqtc|D] }||||<tW|}te|d,r |j3|_3ti||||j||}d-|_0d$|_-nu|j0d-kr|}ng|j$||}nJtk|}d.|vrd/|d<tW|}d0}n |/| | || ||||| \}}n:#tl$r,}to|tpj } | r1|j9|d} | r| :|j;rto|txr*|j=}|j>}d1|_0t?||_?nto|tpj r*d2}tWd3d4t|d5}d6|_?nKt?|Ad7}tWd3d8t|d5}d9|_?nYd}~nd}~wwxYw||fS):a Performs a single HTTP request. The 'uri' is the URI of the HTTP resource and can begin with either 'http' or 'https'. The value of 'uri' must be an absolute URI. The 'method' is the HTTP method to perform, such as GET, POST, DELETE, etc. There is no restriction on the methods allowed. The 'body' is the entity body to be sent with the request. It is a string object. Any extra headers that are to be sent with the request should be provided in the 'headers' dictionary. The maximum number of redirect to follow before raising an exception is 'redirections. The default is 5. The return value is a tuple of (response, content), the first being and instance of the 'Response' class, the second being a string that contains the response entity body. rUNrzPython-httplib2/%s (gzip)rz%20 z%0Drz%0Arrr r!) rHrGrrrFrEr)r*rI)rrrFrEr)r*)rrrzaccept-encodingz gzip, deflates z=?z?=etagzif-matchrrVrr308)307rr(rtrx)r,rrwTrrruz last-modifiedrvrrr{rr504risRequest Timeoutz text/plain408)z content-typerrzRequest Timeoutr400z Bad Request)Br __version__r rrr@r\SCHEME_TO_CONNECTIONrYrAr issubclassr%rrrFrEr)r*set_debuglevelrrrrrr]message_from_bytesrr(rreplace_headerr@r decode_header IndexErrorrrrFrJrHrxrr-rr~ fromcacherrrr`rr{rrr2r?rpoprrKHttpLib2ErrorWithResponser_rrvrcr)!rrrr,rrrwconnection_typeconn_keyrzr{rrrmr1rr cached_valuerrrrrrrrrr_rentry_dispositionmerged_responserrg is_timeouts! rr-z Http.requests.M 11'::7**(Ck(Q %#,,C++c5))11$>>FFtUSSC;B3<< 8VY Z|i/H#''11D|&C&:6&BOT.33I>>??o/IJJdNN(#g--'+6l # z ,h ,69J+J+J !!(+++***v~~F|#zz||33C<<BB3GG *F&/C IE{{6400E99'+ :  Q  Q t000DNe4K4K7**"(>77&+O.$66#q((+RTVXZ/3ll89. '%1A%5 /;//+X{ )1H%26H%//);4(I(I%(G33#+D>>-1* ('22(G33!T>>$2B>?^eKeKe7;F|GO4*d22?g;U;U;?;PG$78*m;;.2mmik64R^`h//+X{?c))foo 4H==22$,SMS &.tnnOx99O8@8N5 /7DJPXYYY.H&)HO)-H&&_++)GGJ%%h///)GG)'22#r))%*DN'~~H!GG*.--ik64R^`h++'Xw   #Av~66J !'++Hd;;!JJLLL2 a!:;; 4 zHiG&)HO&)!ffHOO6>2240G'QVjmnujvjv(x(xyyH&7HOO!!ffmmG44G'QVjmnujvjv(x(xyyH&3HOO- 0'""sFH,X1B1K#"X#/LXLFX3EX \>D"\99\>rr)rCrDrErqrr#rrUrYr_rarcrNrprrDEFAULT_MAX_REDIRECTSr-rNrrrrs"   .+0  Q3Q3Q3Q3f!!!qqq5555 ;;;; !!! H#H#H#TM#M#M#^+++ dDG\nrh#h#h#h#h#h#rrc:eZdZdZ dZ dZ dZ dZdZdZ dZ dS) rz>DKKKrc0|dkr|St|)Nr)AttributeError)rrs r __getattr__zResponse.__getattr__s 6>>K && &r) rCrDrErqrrrrvr~r#rrNrrrrsaFF/IG& F+ FH???.'''''rr)NNNNN)r")r"N)irqr __copyright____contributors__ __license__rrrrRremail.feedparserr email.message email.utilsrfrrrhashlibrrrrr http.clientr"rrr rrr9sysrrrrr ImportErrorrUr rer r__all__rrrrZrG frozensetrDhttplib2r1wherer'rAr;rKr`ricompilerorsrrASCIIrrrrrrUSE_WWW_AUTH_STRICT_PARSINGrrrrrrobjectrrGrQrsrrr\r[rrrrrrrr r r HTTPSConnectionr%rrrrrNrrrs11 0 .           LLLL     *    3 9:: 5;==gc>488[GGCIZ<[<[  ****ZRRR   bjMNNCCC 6 6 6" :&& BJ("( 3 3 )))0"*/00       HHHV."'&'&'&T33333V333l " " " " ". " " "DDDDD>DDDNKKKKK~KKK\        6 C C C C C C C CH! "*, MLL % % % % % % % %F ' ' ' ' '& ' ' ' , , , , ,{ , , ,     v   TTTTTTTTn : : : :