Fix TrueLayer
This commit is contained in:
parent
88e87e53d5
commit
b53fbfc905
|
@ -1,5 +1,6 @@
|
|||
# Twisted/Klein imports
|
||||
from twisted.logger import Logger
|
||||
from twisted.internet.task import LoopingCall
|
||||
|
||||
# Other library imports
|
||||
import requests
|
||||
|
@ -19,6 +20,8 @@ class TrueLayer(object):
|
|||
def __init__(self):
|
||||
self.log = Logger("truelayer")
|
||||
self.token = None
|
||||
self.lc = LoopingCall(self.get_new_token)
|
||||
self.lc.start(int(settings.TrueLayer.RefreshSec))
|
||||
|
||||
def setup_auth(self):
|
||||
pass
|
||||
|
@ -101,13 +104,12 @@ class TrueLayer(object):
|
|||
Get a list of accounts.
|
||||
"""
|
||||
headers = {"Authorization": f"Bearer {self.token}"}
|
||||
# path = f"{settings.TrueLayer.DataBase}/accounts"
|
||||
path = "https://api.truelayer-sandbox.com/data/v1/accounts"
|
||||
path = f"{settings.TrueLayer.DataBase}/accounts"
|
||||
r = requests.get(path, headers=headers)
|
||||
try:
|
||||
parsed = r.json()
|
||||
except JSONDecodeError:
|
||||
self.log.error("Error parsing institutions response: {content}", content=r.content)
|
||||
return False
|
||||
print("GET ACCOUNTS", parsed)
|
||||
|
||||
return parsed
|
||||
|
|
Loading…
Reference in New Issue