L is,ddlZddlZddlZddlZddlmZmZddl m Z ddl ddl m Z ddlmZddlmZdd lmZdd lmZdd lmZdd lmZddldd lmZmZddlmZdgZdZidddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0Z d1Z!e"d2eee e#fiZ$e"d3eeejJjLjNe#fiZ(d5d4Z)y)6N)registerDateHandler _parse_date)convert_to_utf8)*)_BaseHTMLProcessor)http)mixin)_FeedParserMixin)_LooseFeedParser)_StrictFeedParser)replace_doctype)convert_to_idnmake_safe_absolute_uri)FeedParserDict drv_libxml2Tunknownrss090zRSS 0.90rss091nzRSS 0.91 (Netscape)rss091uzRSS 0.91 (Userland)rss092zRSS 0.92rss093zRSS 0.93rss094zRSS 0.94rss20zRSS 2.0rss10zRSS 1.0rsszRSS (unknown version)atom01zAtom 0.1atom02zAtom 0.2atom03zAtom 0.3atom10zAtom 1.0atomzAtom (unknown version)cdfCDFc t|dr|jSt|tr@tj j |ddvrtj||||||||S t|d5}|j} ddd| S#1swY SxYw#ttttf$rYnwxYwt|ts|jdS|S)aEURL, filename, or string --> stream This function lets you define parsers that take any input source (URL, pathname to local or network file, or actual data as a string) and deal with it in a uniform manner. Returned object is guaranteed to have all the basic stdio read methods (read, readline, readlines). Just .close() the object when you're done with it. If the etag argument is supplied, it will be used as the value of an If-None-Match request header. If the modified argument is supplied, it can be a tuple of 9 integers (as returned by gmtime() in the standard Python time module) or a date string in any format supported by feedparser. Regardless, it MUST be in GMT (Greenwich Mean Time). It will be reformatted into an RFC 1123-compliant date and used as the value of an If-Modified-Since request header. If the agent argument is supplied, it will be used as the value of a User-Agent request header. If the referrer argument is supplied, it will be used as the value of a Referer[sic] request header. If handlers is supplied, it is a list of handlers used to build a urllib2 opener. if request_headers is supplied it is a dictionary of HTTP request headers that will override the values generated by FeedParser. :return: A bytes object. readr)r httpsftpfilefeedrbNutf-8)hasattrr& isinstancestrurllibparseurlparser getopenIOErrorUnicodeEncodeError TypeError ValueErrorbytesencode) url_file_stream_or_stringetagmodifiedagentreferrerhandlersrequest_headersresultfdatas T/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/feedparser/api.py_open_resourcerFLsD(&1(--//+S1 << !: ;A >Bj jxx145(T\^mouvv  +T 2 a668D     'J ?    / 7(//88 $$s0. B":B B"BB"B""B>=B>LooseFeedParserStrictFeedParserc  |r| |ddl} |s  j}|  j} |  j}t dgt i} t |||||||| } | s| S| dj|xsit| d| | } | dxrdxsd}t| \| d <} }| djd d }| jd d }t||xst|xs|}| djd d}t|tr||j!dd}t"sd}|r't%||d} || _| | _t*j,j/t0}|j3t*j,j4j6d |j3t*j,j4j8d|j=| |j?| t*j,j@jC}|jEtGjH|  |jK||s=tQ||d|} || _| | _| jS| j!dd jT| d<| jV| d<| d xs | jX| d <| jZ| d<| S#t jj$r } | jd| d| cYd} ~ Sd} ~ wwxYw#t*j,j:$rYdwxYw#t*j,jL$r%}d| d<| jNxs|| d<d}Yd}~%d}~wwxYw)aParse a feed from a URL, file, stream, or string. :param url_file_stream_or_string: File-like object, URL, file path, or string. Both byte and text strings are accepted. If necessary, encoding will be derived from the response headers or automatically detected. Note that strings may trigger network I/O or filesystem access depending on the value. Wrap an untrusted string in a :class:`io.StringIO` or :class:`io.BytesIO` to avoid this. Do not pass untrusted strings to this function. When a URL is not passed the feed location to use in relative URL resolution should be passed in the ``Content-Location`` response header (see ``response_headers`` below). :param str etag: HTTP ``ETag`` request header. :param modified: HTTP ``Last-Modified`` request header. :type modified: :class:`str`, :class:`time.struct_time` 9-tuple, or :class:`datetime.datetime` :param str agent: HTTP ``User-Agent`` request header, which defaults to the value of :data:`feedparser.USER_AGENT`. :param referrer: HTTP ``Referer`` [sic] request header. :param request_headers: A mapping of HTTP header name to HTTP header value to add to the request, overriding internally generated values. :type request_headers: :class:`dict` mapping :class:`str` to :class:`str` :param response_headers: A mapping of HTTP header name to HTTP header value. Multiple values may be joined with a comma. If a HTTP request was made, these headers override any matching headers in the response. Otherwise this specifies the entirety of the response headers. :type response_headers: :class:`dict` mapping :class:`str` to :class:`str` :param bool resolve_relative_uris: Should feedparser attempt to resolve relative URIs absolute ones within HTML content? Defaults to the value of :data:`feedparser.RESOLVE_RELATIVE_URIS`, which is ``True``. :param bool sanitize_html: Should feedparser skip HTML sanitization? Only disable this if you know what you are doing! Defaults to the value of :data:`feedparser.SANITIZE_HTML`, which is ``True``. :return: A :class:`FeedParserDict`. NrF)bozoentriesr*headersT)rJbozo_exceptionrLencodingversionzcontent-locationrhrefzcontent-languager,ignorerrJrMreplacer*rK namespaces). feedparser USER_AGENT SANITIZE_HTMLRESOLVE_RELATIVE_URISrrFr0errorURLErrorupdaterrr3rr.r9decode_XML_AVAILABLErHresolve_relative_uris sanitize_htmlxmlsax make_parserPREFERRED_XML_PARSERS setFeaturehandlerfeature_namespacesfeature_external_gesSAXNotSupportedExceptionsetContentHandlersetErrorHandler xmlreader InputSource setByteStreamioBytesIOr1 SAXExceptionexcrGr*feeddatarKrOnamespaces_in_use)r;r<r=r>r?r@rAresponse_headersr]r^rTrBrDrXuse_strict_parserentities contentlocrPbaseuribaselang saxparsersourcees rEr1r1sc^ M)-B-J %%"00 $ * @ @     F7xPXZbdsu{|   9-34 6),dF ;Dz*3tJ ::fb !D$T:6d:PQ[:\d`dGi $$%7>H(E"x';??7H5 %gxA +@ (#0  GG''(=> SWW__??C   !E!Eq I ##J/!!*-""..0RZZ-. " OOF # $WhJ +@ (#0   GY78((F6N"**F9y)?Z-?-?F9%77F< My <<  #   Nww//   ww## "F6N'1~~':F# $ !  "sH K%4LML:LLLL>=L>NM>>N) NNNNNNNNN)*rm urllib.errorr0 urllib.parsexml.saxr_ datetimesrr encodingsr exceptionshtmlrrr r r parsers.looser parsers.strictr sanitizerrsgmlurlsrrutilrrbr\SUPPORTED_VERSIONSrFtypeobjectrGr`rdContentHandlerrHr1rErsk: 7&$#+-&8 '  j$$   j   j  j Y Y " j j j j $  5!(<%~');VD (#''//*H*H&Q}r