}L i\PddlZddlZddlmZddlmZmZddlm Z GddZ y)N)utils) _BASE_URL_ _SENTINEL_)YfDatac eZdZddddddddddeddf dZddZeddZedd Zedd Z edd Z edd Z edd Z eddZ y)SearchTFNc"| |_t|j|_| tur7t j dt d|jj| ||_||_ | |_ ||_ | |_ ||_ ||_||_||_||_||_| |_t)j*|_i|_i|_g|_g|_g|_g|_g|_|j=y)a6 Fetches and organizes search results from Yahoo Finance, including stock quotes and news articles. Args: query: The search query (ticker symbol or company name). max_results: Maximum number of stock quotes to return (default 8). news_count: Number of news articles to include (default 8). lists_count: Number of lists to include (default 8). include_cb: Include the company breakdown (default True). include_nav_links: Include the navigation links (default False). include_research: Include the research reports (default False). include_cultural_assets: Include the cultural assets (default False). enable_fuzzy_query: Enable fuzzy search for typos (default False). recommended: Recommended number of results to return (default 8). session: Custom HTTP session for requests (default None). timeout: Request timeout in seconds (default 30). raise_errors: Raise exceptions on error (default True). )sessionz=Set proxy via new config function: yf.set_config(proxy=proxy)) stacklevelN)r r_datarwarningswarnDeprecationWarning _set_proxyquery max_resultsenable_fuzzy_query news_counttimeout raise_errors lists_count include_cb nav_linksenable_researchenable_cultural_assets recommendedr get_yf_logger_logger _response_all_quotes_news_lists _research_navsearch)selfrrrrrinclude_nav_linksinclude_researchinclude_cultural_assetsrr r proxyrrs U/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/yfinance/search.py__init__zSearch.__init__s* DLL1  " MMY[mz{ | JJ ! !% ( &"4$ (&$*/&=#&**,       c Htd}|j|j|j|jdd|j |j |j|j|j|jd }|jj|jdtt||jj!|||j"}|d|j$vr t'd |j)}||_|j3d gDcgc] }d |vs| c}|_|j3d g|_|j3d g|_|j3dg|_|j3dg|_|j4|j6|j8|j:|j<d|_|S#t*j,$r.|jj/|jd i}YwxYwcc}w)z=Search using the query parameters defined in the constructor.z/v1/finance/searchtss_match_phrase_querynews_cie_vespa) q quotesCountenableFuzzyQuery newsCount quotesQueryId newsQueryId listsCountenableCbenableNavLinksenableResearchReportsenableCulturalAssetsrecommendedCountz: Yahoo GET parameters: )urlparamsrzWill be right backz~*** YAHOO! FINANCE IS CURRENTLY DOWN! *** Our engineers are working quickly to resolve the issue. Thank you for your patience.zI: Failed to retrieve search results and received faulty response instead.quotessymbolnewslistsresearchReportsnav)rDrFrGresearchrI) rrrrrrrrrrr r"debugstrdictr cache_getrtext RuntimeErrorjson_jsonJSONDecodeErrorerrorr#getr%r&r'r(r)r$)r+rBrCdataquotes r0r*z Search.searchUs ./++ $ 7 75+**"nn%)%9%9$($?$? $ 0 0   djj\)A#d6lBSATUVzz##FDLL#Q </499< IJ J 99;D +/88Hb+AW%XQVEVW XXfb) hhw+ "3R8HHUB' #||TZZ$++cgcqcq II'  $$  LL  $**-vw xD  Xs=G( H2H=HHc|jS)z'Get the quotes from the search results.)r%r+s r0rDz Search.quotess||r2c|jS)z%Get the news from the search results.)r&rYs r0rFz Search.newsszzr2c|jS)z&Get the lists from the search results.)r'rYs r0rGz Search.listss{{r2c|jS)z1Get the research reports from the search results.)r(rYs r0rJzSearch.research~~r2c|jS)z1Get the navigation links from the search results.)r)rYs r0rIz Search.navyyr2c|jS)zOGet all the results from the search results: filtered down version of response.)r$rYs r0allz Search.allr_r2c|jS)z-Get the raw response from the search results.)r#rYs r0responsezSearch.responser]r2)returnr )rdlist)rdzdict[str,list])rdrM)__name__ __module__ __qualname__rr1r*propertyrDrFrGrJrIrarcr2r0r r s*+qUYmr"'[`noZ$4l*Xr2r ) rQrRrrconstrrrVrr rjr2r0rms",)DDr2