mirror of
https://github.com/norohind/SquadsActivityMonitor.git
synced 2026-10-22 17:12:08 +03:00
introduce DEMB_CAPI_AUTH variable
This commit is contained in:
2 files changed
+4
-2
No files matched your search
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user