Re-enable Nordigen
This commit is contained in:
parent
8ab915fa65
commit
88e87e53d5
|
@ -17,7 +17,8 @@ class Nordigen(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.log = Logger("nordigen")
|
self.log = Logger("nordigen")
|
||||||
# self.get_access_token()
|
self.token = None
|
||||||
|
self.get_access_token()
|
||||||
|
|
||||||
def get_access_token(self):
|
def get_access_token(self):
|
||||||
"""
|
"""
|
||||||
|
@ -38,10 +39,8 @@ class Nordigen(object):
|
||||||
self.log.error("Error parsing access token response: {content}", content=r.content)
|
self.log.error("Error parsing access token response: {content}", content=r.content)
|
||||||
return False
|
return False
|
||||||
if "access" in parsed:
|
if "access" in parsed:
|
||||||
settings.Nordigen.Access = parsed["access"]
|
self.token = parsed["access"]
|
||||||
settings.write()
|
self.log.info("Refreshed access token - Nordigen")
|
||||||
|
|
||||||
print(dumps(self.get_institutions(""), indent=2))
|
|
||||||
|
|
||||||
def get_institutions(self, country, filter_name=None):
|
def get_institutions(self, country, filter_name=None):
|
||||||
"""
|
"""
|
||||||
|
@ -49,7 +48,7 @@ class Nordigen(object):
|
||||||
"""
|
"""
|
||||||
if not len(country) == 2:
|
if not len(country) == 2:
|
||||||
return False
|
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}"
|
path = f"{settings.Nordigen.Base}/institutions/?country={country}"
|
||||||
r = requests.get(path, headers=headers)
|
r = requests.get(path, headers=headers)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue