L it&ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z dZGddejj ejj"ejj$ZdZd d Zy) N) _parse_date)convert_to_idnzapplication/atom+xml,application/rdf+xml,application/rss+xml,application/x-netcdf,application/xml;q=0.9,text/xml;q=0.2,*/*;q=0.1c.eZdZdZdZeZeZeZeZdZ y)_FeedURLHandlerc||_|SN)status)selfreqfpcodemsgheaderss U/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/feedparser/http.pyhttp_error_defaultz"_FeedURLHandler.http_error_default0s  ctjjj||||||}|s|S||_|j |_|Sr )urllibrequestHTTPRedirectHandlerhttp_error_301r geturlnewurl)r r r rrhdrsresults rrz_FeedURLHandler.http_error_3016sJ33BB4bRVX[]abI    rc$tjj|jd}d|jvsd|vr|j |||||St j|jdjddjj}|jd\}} tjd|dd} |j| ||| |jd|||} |j| S) Nr AuthorizationzWWW-Authenticate :zrealm="([^"]*)"rzwww-authenticate)rparseurlparse get_full_urlrrbase64 decodebytessplitencodedecoderefindall add_passwordhttp_error_auth_reqedreset_retry_count) r r r rrrhostauthuserpasswrealmretrys rhttp_error_401z_FeedURLHandler.http_error_401Fs||$$S%5%5%78; #++ -1C71R**3D#wG G!!#++o">"D"DS"I!"L"S"S"UV]]_jjo e ,g6H.IJ1M %tU3**+=tS'R   rN) __name__ __module__ __qualname__rrhttp_error_300http_error_302http_error_303http_error_307r4rrrr/s' $N#N#N#Nrrc tjj|}|jd||r|jd|t |t r t |}n*t |tjr|j}|rBgd} gd} |jdd| |d|d| |d d z |d |d |d |d fz|r|jd||jdd|r|jdd|z|r|jd||jD]\} } |j| | |jdd|S)Nz User-Agentz If-None-Match)MonTueWedThuFriSatSun) JanFebMarAprMayJunJulAugSepOctNovDeczIf-Modified-Sincez#%s, %02d %s %04d %02d:%02d:%02d GMTrrRefererzAccept-encodingz gzip, deflaterzBasic %sAcceptzA-IMfeed) rrRequest add_header isinstancestrrdatetime utctimetupleitems) urlagent accept_headeretagmodifiedreferrerr/request_headersrshort_weekdaysmonths header_name header_values r_build_urllib2_requestrk\snn$$S)G |U+ ?D1(C x( Hh// 0((* Ke.0UYghpqrhsYtv~@AwBDJKSTUKVYZKZD[]efg]hjrstjuw@AwBDLMNDOYP1P Q9h/ (/: ?J,=>8]3&5%:%:%<6! \; 56 vv& Nrc t |g}nt|ts|g}|i}|jdr|dd}n|jdrd|ddz}|sddlm}|}d} |jdst j j|} | jrt| } | j| d<| jr| jd| j| d<t j j| }tj| jd| jjj!} t|t"s t%|}g} |D]%} | jd | j'| 'd j-| }t/||t0|||| |}t j2j4t7|t9gz}g|_|j=|}|j?}|jA|jBjEDcic]\}}|jG|c}}|d <|rPd |d jId d vr9 tKjLtOjP|j?}n/|r-d|d jId d vr t[j\|}d|d vr>|d jIdd }t|t"r|j!dd}|r||d<d|d vr*|d jIdd }|r||d<t_||d<t|j`t"r |j`j!dd|d<n|j`|d<tc|ddxsd|d<tc|dddk(r d |d <d!|d"<|S#t($r2| j't j j+| YwxYwcc}}w#tRtTtVjXf$r1}d|d<||d<t|tVjXrd}Yd}~}d}~wwxYw#tZjX$rF t[j\|d}n*#tZjX$r}d|d<||d<Yd}~nd}~wwxYwYwxYw)#Nz feed:httprUzfeed:zhttp:r) USER_AGENTzftp:r asciirgzipzcontent-encoding)fileobjTbozobozo_exceptiondeflateirczutf-8ignorez last-modifiedrdmodified_parsedhrefr rri0versionzkThe feed has not changed since you last checked, so the server sent no data. This is a feature, not a bug! debug_message)2r[list startswithrormrr!r"usernamehostnameport urlunparser$standard_b64encodepasswordr'r(bytesrappendUnicodeEncodeErrorquotejoinrk ACCEPT_HEADERr build_openertupler addheadersopenreadcloserr_lowergetrpGzipFileioBytesIOEOFErrorIOErrorstructerrorzlib decompressrr`getattr)r`rcrdrarehandlersrfrrmr/ url_pieces new_piecesbitscropenerfdatakves rrr|se $ ': ~~k"!"g  AB   D >>& !\\**3/   j)J&//JqM#-#6#6"7q8I J 1 ,,))*5C,, 0C0C/DAjFYFYEZ-[-b-b-dellnD c5 !S! D   HHW  KKN  ''$-C%S%hPXZ^`opG ^^ ( (%Orsv8  " S *fnn::FNN<^<^`f`n`naGaG*Z@gr