mirror of
https://gitlab.com/simple-stock-bots/simple-stock-bot.git
synced 2026-06-03 21:00:26 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d5e40a976b | |||
| 2d94d19b52 | |||
| 850598b696 | |||
| 43b58fdbe8 | |||
| 2758c45432 | |||
| c717739b75 |
@@ -1,9 +1,7 @@
|
|||||||
stages:
|
stages:
|
||||||
- lint
|
- lint
|
||||||
- build
|
|
||||||
- build_site
|
- build_site
|
||||||
- deploy
|
- deploy
|
||||||
- deploy_site
|
|
||||||
|
|
||||||
black:
|
black:
|
||||||
stage: lint
|
stage: lint
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ 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__)
|
||||||
|
|
||||||
|
|
||||||
@@ -34,6 +36,12 @@ 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:
|
||||||
|
|||||||
+6
-6
@@ -1,7 +1,7 @@
|
|||||||
image: python:3.11
|
image: python:3.11
|
||||||
|
|
||||||
build_site:
|
build_mkdocs:
|
||||||
stage: build
|
stage: build_site
|
||||||
script:
|
script:
|
||||||
- cd ./site
|
- cd ./site
|
||||||
- pip install -r requirements.txt
|
- pip install -r requirements.txt
|
||||||
@@ -10,14 +10,14 @@ build_site:
|
|||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
|
||||||
deploy_site:
|
pages:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
script:
|
script:
|
||||||
- echo "Publishing site..."
|
- echo "Publishing site..."
|
||||||
dependencies:
|
dependencies:
|
||||||
- build_site
|
- build_mkdocs
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
rules:
|
# rules:
|
||||||
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
|
# - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
|
||||||
|
|||||||
Reference in New Issue
Block a user