Última actividad 1730172953

yfinance-11.py Sin formato
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)