From cb57a86d46f7928d673a3bb9453bfd638a41a64e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= Date: Mon, 19 Feb 2024 08:53:46 +0100 Subject: [PATCH] Do not consider BME Submitter auth error as fatal This prevents gr_satellites from exiting with a traceback if a connection to the BME Submitter when doing authentication in the constructor of the block cannot be established. This fixes #541. (cherry picked from commit b1babf740d6be43645c5722666e3469894269966) --- python/bme_submitter.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/python/bme_submitter.py b/python/bme_submitter.py index bda20e25..2a19a63a 100644 --- a/python/bme_submitter.py +++ b/python/bme_submitter.py @@ -37,9 +37,13 @@ def __init__(self, user, password, satellite): def authenticate(self, user, password): self.auth_token = None - rauth = requests.post( - 'https://gnd.bme.hu:8080/api/tokens', - auth=HTTPBasicAuth(user, password), timeout=10) + try: + rauth = requests.post( + 'https://gnd.bme.hu:8080/api/tokens', + auth=HTTPBasicAuth(user, password), timeout=10) + except Exception as e: + print(f'Authentication failed: {e}') + return if rauth.status_code == 200: # We hit the jackpot. # Let's use the token obtained in the authentication header.