Skip to content

Commit

Permalink
Do not consider BME Submitter auth error as fatal
Browse files Browse the repository at this point in the history
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 b1babf7)
  • Loading branch information
daniestevez committed Feb 19, 2024
1 parent b34e531 commit cb57a86
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions python/bme_submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cb57a86

Please sign in to comment.