mirror of
https://github.com/Cockatrice/Magic-Spoiler.git
synced 2026-03-21 17:54:59 -05:00
Add 100ms delay between requests
This commit is contained in:
parent
4cef743e46
commit
640675a746
|
|
@ -102,6 +102,8 @@ def json_download(scryfall_url: str) -> Dict[str, Any]:
|
|||
"""
|
||||
session = __get_session()
|
||||
response: Any = session.get(url=scryfall_url, timeout=10.0)
|
||||
if not response.from_cache:
|
||||
time.sleep(0.1) # 100ms delay for good citizenship (10 requests per second)
|
||||
request_api_json: Dict[str, Any] = response.json()
|
||||
print("Downloaded: {} (Cache = {})".format(scryfall_url, response.from_cache))
|
||||
return request_api_json
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user