🎉 Premium Proxies · 24-Hour Free TrialClaim Now
Guides

yfinance Too Many Requests: Fix Rate Limited Errors

Fix yfinance Too Many Requests and YFRateLimitError: why Yahoo returns 429, what yfinance 1.8 retries (and doesn't), and caching, pacing and proxy fixes.

S SparkProxy 4 15 min read
Share
yfinance Too Many Requests: Fix Rate Limited Errors

yfinance too many requests errors come from Yahoo Finance answering HTTP 429. yfinance turns that into YFRateLimitError: Too Many Requests. Rate limited. Try after a while. The usual advice is "wait and retry". That's sometimes right, but often the 429 has nothing to do with how many requests you sent. This guide shows how yfinance 1.8 talks to Yahoo, which retries it does and doesn't do for you, and the fixes that work: upgrading the HTTP backend, caching, pacing, batching and spreading load across IPs within fair limits.

What the Error Actually Means

In yfinance's own source, YFRateLimitError is a single fixed message:

class YFRateLimitError(YFException):
    def __init__(self):
        super().__init__("Too Many Requests. Rate limited. Try after a while.")

yfinance 1.8.0 (released 3 November 2026) raises it in two places:

  • During the crumb fetch. The response status is 429, or the "crumb" text it gets back contains "Too Many Requests".
  • After a data request fails. yfinance switches cookie strategy once, retries, and gets 429 again.

Either way the message tells you Yahoo's edge refused the request. It doesn't tell you why. There are three common reasons, and each has a different fix:

CauseWhat it looks likeFix
Your client doesn't look like a browser429 on the very first call, every timeUpgrade yfinance, make sure `curl_cffi` is installed and used
Burst volume from one IPWorks for a while, then 429 for minutes or hoursCache, batch, pace, back off properly
A shared IP that's already flagged429 in Colab, CI runners or cloud functions but not on your laptopRun from a cleaner IP or spread load across IPs

A 429 on the First Request

On 20 November 2026 we sent the same single request to Yahoo's chart endpoint twice from a server, changing only the User-Agent header:

# curl's default User-Agent (curl/8.x)
curl -s -o /dev/null -D - "https://query1.finance.yahoo.com/v8/finance/chart/AAPL?range=1d&interval=1d"
# HTTP/1.1 429 Too Many Requests
# Server: ATS
# Content-Type: text/html

# Same URL, desktop Chrome User-Agent string
curl -s -o /dev/null -D - -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36" \
  "https://query1.finance.yahoo.com/v8/finance/chart/AAPL?range=1d&interval=1d"
# HTTP/1.1 200 OK
# content-type: application/json;charset=utf-8

No volume was involved. It was one request each, a second apart. Yahoo's edge returned "Too Many Requests" to a client that announced itself as a script and JSON to one that looked like a browser.

So 429 is Yahoo's generic refusal, not proof that you exceeded a quota. A User-Agent string is only the crudest signal, too. Yahoo can also read the TLS handshake. That's why modern yfinance uses curl_cffi, which reproduces Chrome's TLS and HTTP/2 fingerprint rather than just its header. Our explainer on TLS fingerprinting covers what a server can see before your first byte of HTTP.

Free trial

Scraping at scale? Skip the blocks.

Fast, unblockable datacentre proxies with unlimited bandwidth.

Check Your yfinance and curl_cffi Versions

The first fix is often the version. yfinance's HTTP layer _http.py prefers curl_cffi and builds its default session as Session(impersonate="chrome"). If curl_cffi can't be imported, or YF_DISABLE_CURL_CFFI is set, it falls back to plain requests with a hard-coded Chrome 131 User-Agent and logs a warning:

curl_cffi not available; falling back to requests without browser TLS impersonation.
Yahoo Finance may rate-limit or block this client.

The module's own docstring says the fallback "cannot replicate the JA3/JA4 fingerprint and HTTP/2 settings that curl_cffi provides". If you see that warning, fix it before anything else.

import importlib.metadata as md
import yfinance as yf
from yfinance import _http

print("yfinance", md.version("yfinance"))           # 1.8.0 is current (3 Nov 2026)
print("curl_cffi backend:", _http.HAS_CURL_CFFI)      # must be True
try:
    print("curl_cffi", md.version("curl_cffi"))      # yfinance 1.8 requires >= 0.17
except md.PackageNotFoundError:
    print("curl_cffi missing: pip install -U yfinance curl_cffi")

These versions matter for rate limiting:

yfinanceChange
0.2.52Raises `YFRateLimitError` when rate limited
0.2.58 to 0.2.59Fixes false rate-limit detection
0.2.60Fixes cookie reuse, handles DNS-blocked `fc.yahoo.com`
0.2.62Detects rate limiting during the crumb fetch
1.0New `yf.config` class and an optional retry for transient network errors
1.4.0`curl_cffi` becomes optional, with the `requests` fallback
1.5.2Fixes breakage with `curl_cffi` 0.16
1.7.0More reliable behind SOCKS5 proxies
1.8.0`download(threads=N)` now honours the cap. `curl_cffi>=0.17` required

If you pinned yfinance in 2025 to "fix" a rate-limit bug, that pin is now probably causing one. Run pip install -U yfinance curl_cffi and test again before changing any code.

yfinance Retries Don't Cover 429s

yfinance 1.0 added yf.config.network.retries. It's easy to assume this handles rate limits. It doesn't. The retry loop in data.py retries only exceptions its _is_transient_error() check accepts: Timeout, ConnectionError, ReadTimeout, ChunkedEncodingError, RemoteDisconnected and socket errors. It sleeps 2 ** attempt seconds between tries. An HTTP 429 is a successful network round trip with a bad status, so it never enters that loop. It gets one cookie-strategy swap and then raises.

There's a second lesson in yfinance's own threaded attribute fetcher. When one ticker hits YFRateLimitError, it skips the rest. The comment says why: "Once Yahoo rate-limits, more requests only extend the block."

So your retry logic should back off hard and stop hammering:

import random, time
import yfinance as yf
from yfinance.exceptions import YFRateLimitError

yf.config.network.retries = 2          # covers timeouts and dropped connections only

def with_backoff(fn, *args, attempts=5, base=30, cap=900, **kwargs):
    """Retry a yfinance call on YFRateLimitError with long, jittered waits."""
    for attempt in range(attempts):
        try:
            return fn(*args, **kwargs)
        except YFRateLimitError:
            if attempt == attempts - 1:
                raise
            wait = min(cap, base * 2 ** attempt) * random.uniform(0.8, 1.2)
            print(f"rate limited, sleeping {wait:.0f}s (attempt {attempt + 1})")
            time.sleep(wait)

hist = with_backoff(yf.Ticker("AAPL").history, period="1mo")

Start at 30 seconds, not 1. Short retry loops keep the block alive. If five escalating waits (about 15 minutes in total) don't clear it, the problem isn't timing. Go back to the cause table. Our guide to retry and backoff strategies covers jitter and circuit breakers in more depth.

Cache Results Yourself (requests_cache Is Rejected)

Older Stack Overflow answers say to pass a requests_cache.CachedSession to yfinance. Current yfinance rejects it:

YFDataException: Caching sessions (e.g. requests_cache) are not supported.
Solution: stop setting session, let yfinance handle.

yfinance does cache some things internally: timezone lookups (relocatable with yf.set_tz_cache_location()), cookies, and an in-process LRU cache of 64 entries on repeated GETs. None of that survives between runs. The data itself is yours to cache, and that's the single biggest cut in request volume, because daily bars don't change after the close:

from pathlib import Path
import pandas as pd
import yfinance as yf

CACHE = Path("yf_cache"); CACHE.mkdir(exist_ok=True)

def daily_history(symbol: str, period: str = "1y") -> pd.DataFrame:
    """Fetch daily bars once per symbol per day; reuse the parquet file after."""
    stamp = pd.Timestamp.now(tz="America/New_York").date().isoformat()
    path = CACHE / f"{symbol}_{period}_{stamp}.parquet"
    if path.exists():
        return pd.read_parquet(path)
    df = with_backoff(yf.Ticker(symbol).history, period=period, interval="1d")
    if not df.empty:
        df.to_parquet(path)
    return df

The same idea applies to Ticker.info, financials and holders. That data changes at most daily, and some of it quarterly. Fetching .info for 500 tickers every hour is the classic way to earn a multi-hour block.

Batch and Pace Your Calls

Use yf.download() for price history, not a loop of Ticker().history() calls. download() fetches many symbols in parallel with shared session state. Be careful with its default, though. With threads=True, yfinance sets the worker count to min(len(tickers), os.cpu_count()). On a 32-core server, a 500-ticker list fires 32 requests at once, which is exactly the burst Yahoo throttles. Cap it, and from 1.8.0 the cap is actually honoured:

import time
import yfinance as yf

symbols = [...]  # e.g. 500 tickers

frames = []
for i in range(0, len(symbols), 50):           # chunks of 50
    chunk = symbols[i:i + 50]
    frames.append(with_backoff(
        yf.download, chunk, period="6mo", interval="1d",
        threads=4, progress=False, auto_adjust=True,
    ))
    time.sleep(5)                                # pause between chunks

Attributes are expensive. yfinance's own threaded attribute fetcher caps itself at four threads. The source comment says attributes like info "cost several requests per ticker", so it uses fewer threads "to stay under Yahoo's rate limit". Follow that lead:

  • Fetch .info sequentially or with at most 4 workers, and cache it.
  • Ask for only the attributes you need. .fast_info covers price, market cap and similar fields with fewer calls.
  • Don't call .info inside a loop that also downloads history. Split the jobs and run them at different times.

Spread work over time. A nightly job that pulls 2,000 tickers in five minutes looks very different to Yahoo than the same job spread over an hour. If you don't need the data within minutes of the close, add the delay.

Shared Cloud IPs and Proxies

If the same script works on your laptop but fails on Google Colab, GitHub Actions, AWS Lambda or a cheap VPS, the IP is the difference. Those ranges are shared by thousands of users running the same yfinance tutorials, so the address may already be throttled before you send anything. Our write-up on getting rate limited despite rotating proxies explains how reputation follows an address.

yfinance supports proxies through its config, the replacement for the deprecated proxy= arguments:

import os
import yfinance as yf

user, pw = os.environ["SPARKPROXY_USER"], os.environ["SPARKPROXY_PASS"]

# Sticky port: the cookie, crumb and IP stay together for the session
yf.config.network.proxy = f"http://{user}:{pw}@gateway.sparkproxy.io:11002"

# SOCKS5 alternative (yfinance 1.7.0+ is more reliable here)
# yf.config.network.proxy = f"socks5://{user}:{pw}@gateway.sparkproxy.io:13000"

print(yf.Ticker("MSFT").history(period="5d").tail(2))

A string is normalised to {"http": ..., "https": ...} for you (1.5.1, "Normalize configured proxy strings").

Use a sticky session per worker rather than a new IP per request. yfinance's cookie and crumb are fetched once and reused, so keep them on the IP that obtained them. The sticky session proxy guide explains the difference.

Within fair limits. A proxy pool moves you off a burned shared address, and it lets several workers each stay under a sensible per-IP pace. It isn't a way to pull ten times more data from Yahoo than one well-behaved client would. Keep the caching and pacing above in place, because they're what keep each IP clean. SparkProxy sells datacenter proxies: a dedicated, lightly shared datacenter IP is usually far cleaner than a public cloud egress address, but it isn't a residential connection, and we don't claim it is.

When yfinance Is the Wrong Tool

yfinance isn't affiliated with Yahoo. Its README says it "is intended for research and educational purposes", points to Yahoo's terms, and adds that "the Yahoo! finance API is intended for personal use only." That shapes the right fix:

  • Personal research, notebooks, backtests on daily data: cache, pace and upgrade, and you'll rarely see a 429.
  • A product, a client deliverable or anything with an uptime promise: buy licensed market data. No amount of proxy rotation makes Yahoo's free endpoints a supported API, and they change without notice. The 2025 and 2026 changelogs are a list of Yahoo changes yfinance had to chase.
  • Public pages Yahoo serves to browsers, like news or quote pages you're allowed to read, are a scraping problem rather than a yfinance one. Our guide on how to scrape Yahoo Finance covers that approach and its limits.

Fix Checklist

Work down the list. Each step removes one cause:

  1. pip install -U yfinance curl_cffi, then confirm _http.HAS_CURL_CFFI is True and the fallback warning is gone.
  2. Stop passing custom sessions, especially requests_cache. Let yfinance build its own curl_cffi session.
  3. Wrap calls in a backoff that starts at 30 seconds and stops after about 15 minutes.
  4. Cache daily data and fundamentals on disk, keyed by symbol and date.
  5. Use yf.download() in chunks of about 50 with threads=4 and a pause between chunks.
  6. Fetch .info sparingly, with at most 4 workers, or use .fast_info.
  7. If it only fails on cloud or CI runners, move the job to a cleaner IP or a sticky proxy per worker.
  8. If you need guaranteed data, switch to a licensed provider.

Frequently asked questions

FAQ

Yahoo returns HTTP 429 to clients it doesn't trust, not only to clients that send too much. In our test, one request with curl's default User-Agent got 429 while the same request with a Chrome User-Agent got 200. Upgrade yfinance and make sure curl_cffi is installed, so requests carry a browser fingerprint.

Yahoo doesn't publish it. Short bursts usually clear within minutes, while sustained hammering can keep an IP blocked for hours. yfinance's own code notes that more requests during a block only extend it, so back off for at least 30 seconds and grow the wait instead of retrying quickly.

YFRateLimitError is the yfinance exception for HTTP 429 from Yahoo Finance. Its message is always "Too Many Requests. Rate limited. Try after a while." It's raised when the crumb fetch is refused, or when a data request still returns 429 after yfinance retries it with the other cookie strategy.

No. The setting retries only transient network errors such as timeouts and dropped connections, with doubling waits that start at 1 second. An HTTP 429 isn't treated as transient, so it raises YFRateLimitError immediately. Wrap your calls in your own backoff for that.

Not any more. Current yfinance raises YFDataException ("Caching sessions (e.g. requests_cache) are not supported") if you pass a caching session. Cache the returned DataFrames yourself, for example as parquet files keyed by symbol and date.

They fix the case where your IP is the problem, such as shared Colab, CI or cloud addresses that are already throttled. Set yf.config.network.proxy to a sticky proxy per worker so the cookie, crumb and IP stay together. Proxies don't replace caching and pacing, and they don't make Yahoo's free endpoints suitable for commercial use.

Special Discount · 20% off

Get 20% off your first month

Premium datacentre proxies with unlimited bandwidth. Use the code at checkout.

Save up to 15% more on quarterly, half-yearly and yearly plans

Claim Discount

About the Author

This guide was written by the SparkProxy Technical Team. SparkProxy runs datacenter proxy infrastructure and a managed Scraping API for web scraping, automation and QA, with HTTP/HTTPS and SOCKS5 access through gateway.sparkproxy.io. The yfinance behaviour described here comes from the yfinance 1.8.0 source (_http.py, data.py, multi.py, exceptions.py) and its changelog, read on 20 November 2026. The curl comparison and DNS lookups were recorded the same day.

Keep reading

Related articles