Skip to content

[0.2.59] YFRateLimitError: Too Many Requests. Rate limited. #2480

Description

@lixin4sky

Describe bug

YFRateLimitError: Too Many Requests. Rate limited. Try after a while.

This bug is still here, 0.2.59/0.2.58/0.2.57.

Simple code that reproduces your problem

import yfinance as yf

stock = yf.Ticker('SPY')
stock.info

Debug log from yf.enable_debug_mode()

DEBUG get_raw_json(): https://query2.finance.yahoo.com/v10/finance/quoteSummary/SPY
DEBUG Entering get()
DEBUG Entering _make_request()
DEBUG url=https://query2.finance.yahoo.com/v10/finance/quoteSummary/SPY
DEBUG params={'modules': 'financialData,quoteType,defaultKeyStatistics,assetProfile,summaryDetail', 'corsDomain': 'finance.yahoo.com', 'formatted': 'false', 'symbol': 'SPY'}
DEBUG Entering _get_cookie_and_crumb()
DEBUG cookie_mode = 'basic'
DEBUG Entering _get_cookie_and_crumb_basic()
DEBUG crumb = '

         </body></html>
         '

DEBUG Exiting _get_cookie_and_crumb_basic()
DEBUG Exiting _get_cookie_and_crumb()
DEBUG response code=429
DEBUG toggling cookie strategy basic -> csrf
DEBUG Entering _get_cookie_and_crumb()
DEBUG cookie_mode = 'csrf'
DEBUG Entering _get_crumb_csrf()
DEBUG Failed to find "csrfToken" in response
DEBUG Exiting _get_crumb_csrf()
DEBUG toggling cookie strategy csrf -> basic
DEBUG Entering _get_cookie_and_crumb_basic()
DEBUG crumb = '

         </body></html>
         '

DEBUG Exiting _get_cookie_and_crumb_basic()
DEBUG Exiting _get_cookie_and_crumb()
DEBUG response code=429

Bad data proof

Image

yfinance version

0.2.59

Python version

3.10.16/3.13.3

Operating system

OSX

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions