introduce DEMB_CAPI_AUTH variable

This commit is contained in:
norohind committed 2026-01-17 00:06:05 +00:00
1 parent 57793f501b
commit 70650ed157
2 files changed
+4 -2

No files matched your search

+2
View File
@@ -14,6 +14,8 @@ sqlite_db_path = os.getenv('SQLITE_DB_PATH', 'squads_stat.sqlite3')
log_level = os.getenv('LOG_LEVEL', 'DEBUG').upper()
capi_endpoint = os.getenv("DEMB_CAPI_ENDPOINT", "https://capi.demb.uk/random_token")
time_between_requests = os.getenv("TIME_BETWEEN_REQUESTS")
sqlite2postgres_sqlite_location = os.getenv('SQLITE2POSTGRES_SQLITE_LOCATION')
+2 -2
View File
@@ -125,14 +125,14 @@ def _get_bearer() -> str:
:return: bearer token as str
"""
bearer_request: requests.Response = requests.get(
url='https://capi.demb.uk/random_token', headers={'auth': os.environ['DEMB_CAPI_AUTH']}, timeout=30
url=config.capi_endpoint, headers={'auth': os.environ['DEMB_CAPI_AUTH']}, timeout=30
)
try:
bearer: str = bearer_request.json()['access_token']
except Exception as e:
logger.exception(f'Unable to parse capi.demb.uk answer\nrequested: {bearer_request.url!r}\n'
logger.exception(f'Unable to parse {config.capi_endpoint} answer\nrequested: {bearer_request.url!r}\n'
f'code: {bearer_request.status_code!r}\nresponse: {bearer_request.content!r}', exc_info=e)
raise e