mirror of
https://gitlab.com/simple-stock-bots/simple-stock-bot.git
synced 2025-06-15 23:06:40 +00:00
patch
This commit is contained in:
parent
2758c45432
commit
43b58fdbe8
@ -9,6 +9,8 @@ from markdownify import markdownify
|
||||
from common.Symbol import Coin
|
||||
from common.utilities import rate_limited
|
||||
|
||||
import time
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -34,6 +36,11 @@ class cg_Crypto:
|
||||
url = "https://api.coingecko.com/api/v3" + endpoint
|
||||
resp = r.get(url, params=params, timeout=timeout)
|
||||
# Make sure API returned a proper status code
|
||||
|
||||
if resp.status_code == 429:
|
||||
time.sleep(10)
|
||||
log.warning(f"CoinGecko returned 429 - Too Many Requests for endpoint: {endpoint}")
|
||||
|
||||
try:
|
||||
resp.raise_for_status()
|
||||
except r.exceptions.HTTPError as e:
|
||||
|
Loading…
x
Reference in New Issue
Block a user