503 Service unavailable error on request from python script

We have been using a development Vault server at my company. I’ve created a python script that used Vault’s API to login and retrieve some credentials. It has been working for a while now in my development workstation running Arch linux, some docker containers I’ve tried it from (RHEL 7.7) and another workstation running OpenSuse tumbleweed. However, whenever I try to run it on any ubuntu machine (container/VM/WSL), the script fails with the error in the title.

I should probably add that I have enabled the audit log in the vault server, however there are no entries for the failed attempts (only the successful ones)

Any help would be appreciated

Hi! Can you share the script (if it’s short) or at least the calls its making effecting Vault, Vault logs around error time, and/or the specific error you’re receiving? That would make it easier to debug.

Thank you for your reply and sorry for my late one, but I didn’t have access to my work computer during the weekend.

I am using the following script (I’ve simplified it as much as possible so that it has the same behaviour)

import urllib.request
import json
import os

def req(url, data, headers):
    if data is not None:
        data = str(json.dumps(data)).encode('utf-8')

    if headers is None:
        headers = {}

    if data is None:
        req = urllib.request.Request(url, headers=headers)
        req = urllib.request.Request(url, data=data, headers=headers)

    resp = urllib.request.urlopen(req)

def login():
    role_id = '...'
    secret_id = '...'

    serv = os.environ.get('VAULT_HOST', 'http://<url>:8200')
    url = os.path.join(serv, 'v1/auth/approle/login')

    payload = {
        'role_id': role_id,
        'secret_id': secret_id

    req(url, payload, None)


journalctl -u vault contains no logs regarding any errors (don’t think it was supposed to) and the vault audit device logs nothing during these calls.

Lastly, the specific error is simply:
urllib.error.HTTPError: HTTP Error 503: Service Unavailable

Perhaps urllib drops any additional info while the exception is bubbling up, however I cannot replicate it in any RESTful test apps to see if any additional information is provided along with the error.

Again, thank you very much. I am at your disposal for any more info