From 42fdfd96ec7b508b8309f411156d70f7f5b0d0b5 Mon Sep 17 00:00:00 2001 From: norohind <60548839+norohind@users.noreply.github.com> Date: Sun, 10 Apr 2022 19:21:21 +0300 Subject: [PATCH] Requester: add handling for BearerManager fails --- FAPI/Requester.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/FAPI/Requester.py b/FAPI/Requester.py index ef83712..297c39b 100644 --- a/FAPI/Requester.py +++ b/FAPI/Requester.py @@ -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