Skip to main content

HashiCorp Vault API client

Project description

hvac

Header image

HashiCorp Vault API client for Python 2.7/3.x

Travis CI codecov Documentation Status PyPI version Twitter - @python_hvac

Tested against the latest release, HEAD ref, and 3 previous major versions (counting back from the latest release) of Vault. Currently supports Vault v0.9.6 or later.

Documentation

Documentation for this module is hosted on readthedocs.io.

Getting started

Installation

pip install hvac

or

pip install "hvac[parser]"

if you would like to be able to return parsed HCL data as a Python dict for methods that support it.

Initialize the client

import os

import hvac

# Using plaintext
client = hvac.Client()
client = hvac.Client(url='http://localhost:8200')
client = hvac.Client(url='http://localhost:8200', token=os.environ['VAULT_TOKEN'])

# Using TLS
client = hvac.Client(url='https://localhost:8200')

# Using TLS with client-side certificate authentication
client = hvac.Client(url='https://localhost:8200', cert=('path/to/cert.pem', 'path/to/key.pem'))

# Using Namespace
client = hvac.Client(url='http://localhost:8200', token=os.environ['VAULT_TOKEN'], namespace=os.environ['VAULT_NAMESPACE'])

Read and write to secret backends

client.write('secret/foo', baz='bar', lease='1h')

print(client.read('secret/foo'))

client.delete('secret/foo')

Authenticate using token auth backend

# Token
client.token = 'MY_TOKEN'
assert client.is_authenticated() # => True

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hvac-0.7.2.tar.gz (62.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hvac-0.7.2-py2.py3-none-any.whl (167.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file hvac-0.7.2.tar.gz.

File metadata

  • Download URL: hvac-0.7.2.tar.gz
  • Upload date:
  • Size: 62.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for hvac-0.7.2.tar.gz
Algorithm Hash digest
SHA256 773775fa827c74299abd96079eeeeb0cefbb23b484195c03cff27d04716539ba
MD5 1906e8dce2aca455adafd8ee61aae3bd
BLAKE2b-256 8713a97470552dbcc2ff5ca18ba67cd5f6e5dc1954c647a943634cb890f60adb

See more details on using hashes here.

File details

Details for the file hvac-0.7.2-py2.py3-none-any.whl.

File metadata

  • Download URL: hvac-0.7.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 167.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for hvac-0.7.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 001978c8e8778b6eda78bceba5781ba444f9f5f0d94634f9631e5a6a47ebb3c7
MD5 6c6c4c90106f5d7255f670bcff8aacea
BLAKE2b-256 88dd49f4e316369e492d728983a1774367fddc5bb9975d32661247466cfea67c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page