
    N j6                     \    S SK rSSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr   " S S	5      rg)
    N   )utils)YfConfig)
_BASE_URL_)YfData)YFDataExceptionc                       \ rS rSr   SS jrSS jr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
\SS	 j5       r\SS
 j5       r\SS j5       rSrg)Search   Nc                    Xl         [        U R                   S9U l        Xl        X l        Xl        X0l        Xl        Xl        X@l	        XPl
        X`l        Xpl        Xl        Xl        [        R                   " 5       U l        0 U l        0 U l        / U l        / U l        / U l        / U l        / U l        U R3                  5         g)a  
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).
)sessionN)r   r   _dataquerymax_resultsenable_fuzzy_query
news_counttimeoutraise_errorslists_count
include_cb	nav_linksenable_researchenable_cultural_assetsrecommendedr   get_yf_logger_logger	_response_all_quotes_news_lists	_research_navsearch)selfr   r   r   r   r   include_nav_linksinclude_researchinclude_cultural_assetsr   r   r   r   r   s                 `/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/yfinance/search.py__init__Search.__init__    s    * DLL1

&"4$(&$*/&=#&**,	
	    c                    [          S3nU R                  U R                  U R                  U R                  SSU R
                  U R                  U R                  U R                  U R                  U R                  S.nU R                  R                  U R                   S[        [        U5      5       35        U R                  R!                  XU R"                  S9nUb  SUR$                  ;   a  ['        S5      e UR)                  5       nX0l        UR7                  S
/ 5       Vs/ s H  nSU;   d  M  UPM     snU l        UR7                  S/ 5      U l        UR7                  S/ 5      U l        UR7                  S/ 5      U l        UR7                  S/ 5      U l         U R8                  U R:                  U R<                  U R>                  U R@                  S.U l!        U $ ! [*        R,                   aN    [.        R                  R0                  (       d  e U R                  R3                  U R                   S	35        0 n GN4f = fs  snf )z=Search using the query parameters defined in the constructor.z/v1/finance/searchtss_match_phrase_querynews_cie_vespa)qquotesCountenableFuzzyQuery	newsCountquotesQueryIdnewsQueryId
listsCountenableCbenableNavLinksenableResearchReportsenableCulturalAssetsrecommendedCountz: Yahoo GET parameters: )urlparamsr   zWill be right backz)*** YAHOO! FINANCE IS CURRENTLY DOWN! ***z%: 'search' fetch received faulty dataquotessymbolnewslistsresearchReportsnav)r>   r@   rA   researchrC   )"r   r   r   r   r   r   r   r   r   r   r   r   debugstrdictr   	cache_getr   textr   json_jsonJSONDecodeErrorr   hide_exceptionserrorr   getr   r    r!   r"   r#   r   )r%   r<   r=   dataquotes        r)   r$   Search.searchR   s   ./++ $ 7 75+**"nn%)%9%9$($?$? $ 0 0
 	djj\)A#d6lBSATUVzz##DLL#Q</499<!"MNN	99;D +/88Hb+AW+A%XQVEV+AWXXfb)
hhw+"3R8HHUB'	#||TZZ$++cgcqcq II'	 # $$ 	>>11LL$**-RSTD		 Xs   <G &
I4IAI Ic                     U R                   $ )z'Get the quotes from the search results.)r   r%   s    r)   r>   Search.quotes~   s     ||r,   c                     U R                   $ )z%Get the news from the search results.)r    rT   s    r)   r@   Search.news   s     zzr,   c                     U R                   $ )z&Get the lists from the search results.)r!   rT   s    r)   rA   Search.lists   s     {{r,   c                     U R                   $ )z1Get the research reports from the search results.)r"   rT   s    r)   rD   Search.research        ~~r,   c                     U R                   $ )z1Get the navigation links from the search results.)r#   rT   s    r)   rC   
Search.nav        yyr,   c                     U R                   $ )zOGet all the results from the search results: filtered down version of response.)r   rT   s    r)   all
Search.all   r_   r,   c                     U R                   $ )z-Get the raw response from the search results.)r   rT   s    r)   responseSearch.response   r\   r,   )r   r   r!   r   r#   r    r   r"   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )   rf   rf   TFFFFrf   N   T)returnr
   )rh   list)rh   zdict[str,list])rh   rG   )__name__
__module____qualname____firstlineno__r*   r$   propertyr>   r@   rA   rD   rC   ra   rd   __static_attributes__ r,   r)   r
   r
      s    mrno8<0d*X              r,   r
   )rJ   rK    r   configr   constr   rP   r   
exceptionsr   r
   rp   r,   r)   <module>ru      s%   ,      '@ @r,   