diff options
author | 2018-02-11 18:33:04 +0000 | |
---|---|---|
committer | 2018-02-11 18:33:04 +0000 | |
commit | 519d446732eb493013b1be655ec6f3ea2ff6759d (patch) | |
tree | de1e48d5213c541c256b23dc505ff1111eee0e3d /pysite | |
parent | [Asana] Better errors (diff) |
[Asana] Supply bearer token to API calls
Diffstat (limited to 'pysite')
-rw-r--r-- | pysite/views/api/asana.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pysite/views/api/asana.py b/pysite/views/api/asana.py index 4cefb3ff..9cac5f38 100644 --- a/pysite/views/api/asana.py +++ b/pysite/views/api/asana.py @@ -10,6 +10,7 @@ from pysite.base_route import APIView from pysite.constants import ErrorCodes ASANA_KEY = os.environ.get("ASANA_KEY") +ASANA_TOKEN = os.environ.get("ASANA_TOKEN") ASANA_WEBHOOK = os.environ.get("ASANA_WEBHOOK") BASE_URL = "https://app.asana.com/api/1.0" @@ -85,6 +86,8 @@ class IndexView(APIView): def asana_story(self, *, resource, parent, created_at, user, action, type): session = requests.session() + session.headers["Authorization"] = f"Bearer {ASANA_TOKEN}" + resp = session.get(f"{STORY_URL}/{resource}").json() resp.raise_for_status() story = resp.json() @@ -128,6 +131,7 @@ class IndexView(APIView): def asana_task(self, *, resource, parent, created_at, user, action, type): session = requests.session() + session.headers["Authorization"] = f"Bearer {ASANA_TOKEN}" resp = session.get(f"{TASK_URL}/{resource}") resp.raise_for_status() |