Daml Hub service account errors

I’m trying to use Daml Hub service account login to retrieve access tokens so that I don’t have to refresh the token in every 24 hours.

I’m using the requests Python library and implemented this try/except expression because the service account endpoint call fails with 502 error in the majority of cases (not always):

SA_LOGIN = f"https://{HUB_LEDGER_ID}.daml.app:443/.hub/v1/sa/login"
response = requests.post(SA_LOGIN, auth=('cred-XXXXXXXXXXXXXX', 'XXXXXXXXXXXXXX'))
try:
  EVERLY_TOKEN = response.json()['token']
  print("Service account token exchange successful")
except:
    print("Service account token exchange didn't succeed, fetch token manually")
    EVERLY_TOKEN = input("Insert Everly token ")

Am I doing something wrong?

Anyway, it works good enough so I close this question.

Hey Gyorgy,

Sorry for the lack of response here - this one got lost in the holiday shuffle.

Intermittent 502 errors seem bad and wrong; I’m going to look into this and get back to you.

1 Like

I’ve implemented a retry mechanism and currently testing how reliable it gets in this way.