diff --git a/.github/workflows/run-pipeline.yml b/.github/workflows/run-pipeline.yml index d7d3e2d..e9d6132 100644 --- a/.github/workflows/run-pipeline.yml +++ b/.github/workflows/run-pipeline.yml @@ -27,6 +27,10 @@ jobs: run: pipenv install --ignore-pipfile - name: Run python code + env: # Set the secret as an input + FUTURE_FIRST: ${{ secrets.FUTURE_FIRST }} + # FIRST_NAME: Joel + # LAST_NAME: Suss run: pipenv run start - uses: stefanzweifel/git-auto-commit-action@v4 diff --git a/src/fetch.py b/src/fetch.py index af17082..bcd949b 100644 --- a/src/fetch.py +++ b/src/fetch.py @@ -1,21 +1,23 @@ import requests +import os def get_data(): - # res = requests.get("https://dummyjson.com/products?limit=10&select=id,title,brand,price") - # data = res.json().get('products') - # print(f"Loaded {len(data)} rows of JSON from the API") - # return data - # r = requests.get("https://www.goodjudgment.io/futurefirst/api/forecasts", headers = {"Authorization": "Bearer 8030152dfa8a9930ec132f831500dd54c55c1889"}) - r = requests.get("https://goodjudgment.io/futurefirst/api/fcsv", headers = {"Authorization": "Bearer 8030152dfa8a9930ec132f831500dd54c55c1889"}) + + # Retrieve the environment variable "key" + key = os.getenv("FUTURE_FIRST") - #r.json() - #r.json()["status"] + # r = requests.get("https://goodjudgment.io/futurefirst/api/fcsv", headers = {"Authorization": "Bearer 8030152dfa8a9930ec132f831500dd54c55c1889"}) + + r = requests.get( + "https://goodjudgment.io/futurefirst/api/fcsv", + headers = {"Authorization": "Bearer " + key} + ) + data = r.json()["data"] print(f"Loaded {len(data)} rows of CSV from the API") return data - #res = r.json() - +