Remove fail argument in TrueLayer
This commit is contained in:
parent
4033496866
commit
cb4dbe18f6
|
@ -23,9 +23,6 @@ class TrueLayer(object):
|
||||||
self.lc = LoopingCall(self.get_new_token)
|
self.lc = LoopingCall(self.get_new_token)
|
||||||
self.lc.start(int(settings.TrueLayer.RefreshSec))
|
self.lc.start(int(settings.TrueLayer.RefreshSec))
|
||||||
|
|
||||||
def setup_auth(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def create_auth_url(self):
|
def create_auth_url(self):
|
||||||
query = urllib.parse.urlencode(
|
query = urllib.parse.urlencode(
|
||||||
{
|
{
|
||||||
|
@ -63,7 +60,7 @@ class TrueLayer(object):
|
||||||
self.token = parsed["access_token"]
|
self.token = parsed["access_token"]
|
||||||
self.log.info("Retrieved access/refresh tokens - TrueLayer")
|
self.log.info("Retrieved access/refresh tokens - TrueLayer")
|
||||||
|
|
||||||
def get_new_token(self, fail=False):
|
def get_new_token(self):
|
||||||
"""
|
"""
|
||||||
Exchange our refresh token for an access token.
|
Exchange our refresh token for an access token.
|
||||||
"""
|
"""
|
||||||
|
@ -80,8 +77,6 @@ class TrueLayer(object):
|
||||||
try:
|
try:
|
||||||
parsed = r.json()
|
parsed = r.json()
|
||||||
except JSONDecodeError:
|
except JSONDecodeError:
|
||||||
if fail:
|
|
||||||
exit()
|
|
||||||
return False
|
return False
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
if "access_token" in parsed.keys():
|
if "access_token" in parsed.keys():
|
||||||
|
@ -90,13 +85,9 @@ class TrueLayer(object):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
self.log.error(f"Token refresh didn't contain access token: {parsed}", parsed=parsed)
|
self.log.error(f"Token refresh didn't contain access token: {parsed}", parsed=parsed)
|
||||||
if fail:
|
|
||||||
exit()
|
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
self.log.error(f"Cannot refresh token: {parsed}", parsed=parsed)
|
self.log.error(f"Cannot refresh token: {parsed}", parsed=parsed)
|
||||||
if fail:
|
|
||||||
exit()
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_accounts(self):
|
def get_accounts(self):
|
||||||
|
|
Loading…
Reference in New Issue