forked from platformio/platformio-core
Fix a bug with expired account session
This commit is contained in:
@ -16,7 +16,7 @@ import os
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from platformio import __accounts_api__, app
|
from platformio import __accounts_api__, app
|
||||||
from platformio.clients.http import HTTPClient
|
from platformio.clients.http import HTTPClient, HTTPClientError
|
||||||
from platformio.exception import PlatformioException
|
from platformio.exception import PlatformioException
|
||||||
|
|
||||||
|
|
||||||
@ -69,6 +69,12 @@ class AccountClient(HTTPClient): # pylint:disable=too-many-public-methods
|
|||||||
kwargs["headers"] = headers
|
kwargs["headers"] = headers
|
||||||
return self.fetch_json_data(*args, **kwargs)
|
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):
|
def login(self, username, password):
|
||||||
try:
|
try:
|
||||||
self.fetch_authentication_token()
|
self.fetch_authentication_token()
|
||||||
|
Reference in New Issue
Block a user