mirror of
https://gitlab.com/simple-stock-bots/simple-stock-bot.git
synced 2026-06-03 21:00:26 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dd8b4f0d04 | |||
| 533e4fa7d1 | |||
| 0b99c4435d |
@@ -9,8 +9,6 @@ from markdownify import markdownify
|
|||||||
from common.Symbol import Coin
|
from common.Symbol import Coin
|
||||||
from common.utilities import rate_limited
|
from common.utilities import rate_limited
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@@ -36,12 +34,6 @@ class cg_Crypto:
|
|||||||
url = "https://api.coingecko.com/api/v3" + endpoint
|
url = "https://api.coingecko.com/api/v3" + endpoint
|
||||||
resp = r.get(url, params=params, timeout=timeout)
|
resp = r.get(url, params=params, timeout=timeout)
|
||||||
# Make sure API returned a proper status code
|
# Make sure API returned a proper status code
|
||||||
|
|
||||||
if resp.status_code == 429:
|
|
||||||
log.warning(f"CoinGecko returned 429 - Too Many Requests for endpoint: {endpoint}. Sleeping and trying again.")
|
|
||||||
time.sleep(10)
|
|
||||||
return self.get(endpoint=endpoint, params=params, timeout=timeout)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
except r.exceptions.HTTPError as e:
|
except r.exceptions.HTTPError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user