From 76f85d9ddcb87b691ce5ad48d6518ef1531a5841 Mon Sep 17 00:00:00 2001 From: oscgonfer Date: Wed, 15 May 2024 12:13:58 +0200 Subject: [PATCH] Missing search sc bearer fix --- smartcitizen_connector/search/search.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smartcitizen_connector/search/search.py b/smartcitizen_connector/search/search.py index 2ead984..4964360 100644 --- a/smartcitizen_connector/search/search.py +++ b/smartcitizen_connector/search/search.py @@ -87,9 +87,13 @@ def search_by_query(endpoint: Optional[str] = 'devices', if 'SC_ADMIN_BEARER' in environ: logger.info('Admin Bearer found, using it') headers = {'Authorization':'Bearer ' + environ['SC_ADMIN_BEARER']} + elif 'SC_BEARER' in environ: + logger.info('Bearer found in environment, using it.') + # TODO make this explicit + headers = {'Authorization':'Bearer ' + environ['SC_BEARER']} else: + logger.warning('No Bearer not found, you might get throttled!') headers = None - logger.info('Admin Bearer not found') url = f'{config.API_URL}{endpoint}/?' url_queries = 0