Python script to renew key from Vault every 30s A small Python lib to renew key from Vault every 30s to always get the latest key. 

from __future__ import print_function

import hvac
import time
import threading
import os


VAULT_URL = os.environ['VAULT_ADDR']
VAULT_TOKEN = os.environ['VAULT_TOKEN']


class Client:
    def __init__(self, *keys):
        self.keys = keys
        self.data_dict = {}
        self.client = hvac.Client(
            url=VAULT_URL,
            token=VAULT_TOKEN)

        self.__renew()

    def read(self):
        for key in self.keys:
            self.data_dict[key] = self.client.read(key)
        return self.data_dict

    def __renew(self):
        self.client.renew_token()
        threading.Timer(30, self.__renew).start()
        self.read()

if __name__ == '__main__':
    client = Client('secret/key')
    print(client.read())
You don't need a class here. Neither you need a Timer.

import hvac
import time
import threading
import os
import sys


VAULT_URL, VAULT_TOKEN = sys.argv[1:]


def read(client, *keys):
    client.renew_token()
    return {k: client.read(key) for key in keys}


if __name__ == '__main__':
    client = hvac.Client(url=VAULT_URL, token=VAULT_TOKEN)
    while True:
        print(read(client, 'secret/key'))
        time.sleep(30)