Zuletzt aktiv 1730172953

Änderung fa9e74abfdb84fab15a23199b6426dbbd36d30da

yfinance-11.py Orginalformat
1from requests import Session
2from requests_cache import CacheMixin, SQLiteCache
3from requests_ratelimiter import LimiterMixin, MemoryQueueBucket
4from pyrate_limiter import Duration, RequestRate, Limiter
5class CachedLimiterSession(CacheMixin, LimiterMixin, Session):
6 pass
7
8session = CachedLimiterSession(
9 limiter=Limiter(RequestRate(2, Duration.SECOND*5)), # max 2 requests per 5 seconds
10 bucket_class=MemoryQueueBucket,
11 backend=SQLiteCache("yfinance.cache"),
12)