Fix a bug with expired account session

This commit is contained in:
Ivan Kravets
2021-12-20 19:27:56 +02:00
parent 6e03eff303
commit b7f685ed62

View File

@ -16,7 +16,7 @@ import os
import time
from platformio import __accounts_api__, app
from platformio.clients.http import HTTPClient
from platformio.clients.http import HTTPClient, HTTPClientError
from platformio.exception import PlatformioException
@ -69,6 +69,12 @@ class AccountClient(HTTPClient): # pylint:disable=too-many-public-methods
kwargs["headers"] = headers
return self.fetch_json_data(*args, **kwargs)
def fetch_json_data(self, *args, **kwargs):
try:
return super(AccountClient, self).fetch_json_data(*args, **kwargs)
except HTTPClientError as exc:
raise AccountError(str(HTTPClientError)) from exc
def login(self, username, password):
try:
self.fetch_authentication_token()