added return self for ease of code when refreshing access token
This commit is contained in:
parent
9b5f7ff103
commit
ad81f3c537
@ -1,3 +1,4 @@
|
|||||||
|
from __future__ import annotations
|
||||||
import requests
|
import requests
|
||||||
from spotframework.model.user import User
|
from spotframework.model.user import User
|
||||||
from spotframework.util.console import Color
|
from spotframework.util.console import Color
|
||||||
@ -32,7 +33,7 @@ class NetworkUser(User):
|
|||||||
return Color.RED + Color.BOLD + 'NetworkUser' + Color.END + \
|
return Color.RED + Color.BOLD + 'NetworkUser' + Color.END + \
|
||||||
f': {self.username}, {self.display_name}, {self.uri}'
|
f': {self.username}, {self.display_name}, {self.uri}'
|
||||||
|
|
||||||
def refresh_access_token(self) -> None:
|
def refresh_access_token(self) -> NetworkUser:
|
||||||
|
|
||||||
if self.refresh_token is None:
|
if self.refresh_token is None:
|
||||||
raise NameError('no refresh token to query')
|
raise NameError('no refresh token to query')
|
||||||
@ -78,6 +79,8 @@ class NetworkUser(User):
|
|||||||
error_description = req.json().get('error_description', 'n/a')
|
error_description = req.json().get('error_description', 'n/a')
|
||||||
logger.error(f'get {req.status_code} {error_text} - {error_description}')
|
logger.error(f'get {req.status_code} {error_text} - {error_description}')
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
def refresh_info(self) -> None:
|
def refresh_info(self) -> None:
|
||||||
info = self.get_info()
|
info = self.get_info()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user