Skip to main content

HashiCorp Vault API client

Project description

hvac

HashiCorp Vault API client for Python 2.7/3.x

Travis CI codecov Documentation Status PyPI version

Tested against the latest release, HEAD ref, and 3 previous major versions (counting back from the latest release) of Vault. Currently supports Vault v0.8.3 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.0.tar.gz (100.2 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.0-py2.py3-none-any.whl (145.2 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: hvac-0.7.0.tar.gz
  • Upload date:
  • Size: 100.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.14

File hashes

Hashes for hvac-0.7.0.tar.gz
Algorithm Hash digest
SHA256 4fc3ca6b463200da5186a520ba7f6ce6d2873f9df0139e326665e9ea22514db3
MD5 2d036baa7e103f5ca134a13bb0f98293
BLAKE2b-256 5572f378e24753f769da07ed4efc0e296f2864affe9e22c6ff3e2a07565e6615

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hvac-0.7.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 145.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/2.7.14

File hashes

Hashes for hvac-0.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d041ecc105c96ac11de2d3f8d48eca10c096fcb922f8e88ed1af69691100a8a4
MD5 98cb412ef349efed9f40709b7f9d643d
BLAKE2b-256 133bf8c281deab7ee3073c15ab4f10d8bd45c11123aabdbbe1cb3837b3b5df1a

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