Requester: add handling for BearerManager fails

This commit is contained in:
norohind 2022-04-10 19:21:21 +03:00
parent 3ea43f8df9
commit 42fdfd96ec
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1

View File

@ -2,7 +2,7 @@ import os
import time
import json
import requests
from .BearerManager import bearer_manager
from .BearerManager import bearer_manager, BearerManagerException
from loguru import logger
from . import Exceptions
@ -86,6 +86,10 @@ def request(url: str, method: str = 'get', **kwargs) -> requests.Response:
selected_proxy['last_try'] = time.time() # Anyway set last try to now
continue
except BearerManagerException as e:
logger.opt(exception=True).error(f'Error on getting bearer token')
continue
selected_proxy['last_try'] = time.time() # Set last try to now
if proxiedFapiRequest.status_code == 418: # FAPI is on maintenance