1
0
mirror of https://gitlab.com/simple-stock-bots/simple-stock-bot.git synced 2025-06-16 07:16:40 +00:00
This commit is contained in:
Anson 2023-10-16 23:53:28 -06:00
parent 2758c45432
commit 43b58fdbe8

View File

@ -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: