From 88e87e53d54e4bcc9cac6f294ce96b4e3643f7f0 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Fri, 4 Mar 2022 21:06:20 +0000 Subject: [PATCH] Re-enable Nordigen --- handler/sinks/nordigen.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/handler/sinks/nordigen.py b/handler/sinks/nordigen.py index 6cb145b..3b638bf 100644 --- a/handler/sinks/nordigen.py +++ b/handler/sinks/nordigen.py @@ -17,7 +17,8 @@ class Nordigen(object): def __init__(self): self.log = Logger("nordigen") - # self.get_access_token() + self.token = None + self.get_access_token() def get_access_token(self): """ @@ -38,10 +39,8 @@ class Nordigen(object): self.log.error("Error parsing access token response: {content}", content=r.content) return False if "access" in parsed: - settings.Nordigen.Access = parsed["access"] - settings.write() - - print(dumps(self.get_institutions(""), indent=2)) + self.token = parsed["access"] + self.log.info("Refreshed access token - Nordigen") def get_institutions(self, country, filter_name=None): """ @@ -49,7 +48,7 @@ class Nordigen(object): """ if not len(country) == 2: return False - headers = {"accept": "application/json", "Authorization": f"Bearer {settings.Nordigen.Access}"} + headers = {"accept": "application/json", "Authorization": f"Bearer {self.token}"} path = f"{settings.Nordigen.Base}/institutions/?country={country}" r = requests.get(path, headers=headers) try: