Infisical SDK Python wrapper with environment validation and secret helpers
Project description
Infisical Secrets Wrapper
A clean, Pythonic wrapper around the Infisical SDK with:
- automatic environment validation
- client initialisation
- fetch secrets for a given 'project'
- single-secret lookup
- clean error handling
Purpose
- Unified way of getting secrets into python scripts in a secure mmanner
- Keep Dry. A lot of verbosity otherwise required to reliably pull secrets.
- Simplify
- catch things that go wrong.
Pre-requisites
- A self-hosted Infisical Server.
- Universal Auth Credentials for the server.
- Access to
/etc/environment
Installation
pip install infisical-wrapper
Create Infisical Creds
These can be found or created in the Infisical ui at
Access Control/Machine Identities/Create or click Organization Machine Identity/Universal Auth dropdown/
Here you will find Client ID and Client Secret
INFISICAL HOST="http(s)://<host>:<port>"
INFISICAL_CLIENT_ID= "<YOUR ID>"
INFISICAL_CLIENT_SECRET= "<YOUR SECRET>"
Put these in /etc/environmment to be accessible globally on your node.
Log out and in again.
Alternatively keep them in .env which are picked up on fallback.
These allow the module to reach your Infisical Server.
Usage
from infisical_wrapper import Infisical
mgr = Infisical()
client = mgr.init_client()
# Fetch all Secrets for a Project
secrets = mgr.fetch_secrets("my-project")
print(f"\n🔑 Secrets dictionary:\n{secrets}")
# Get a specific Secret for a Project
password = mgr.get_secret("my-project", "prod", "DB_PASSWORD")
print(password)
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file infisical_wrapper-1.0.0.tar.gz.
File metadata
- Download URL: infisical_wrapper-1.0.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c66058397405abc6835e2395c668ee89386302d8555333d89f474529225fb05
|
|
| MD5 |
5c3afa698e3349cdbba69df8c7799c6c
|
|
| BLAKE2b-256 |
0738d8b7c3deb4ae8a52d884817d9405803e06a5a5adefef030a861a7dd34772
|
File details
Details for the file infisical_wrapper-1.0.0-py3-none-any.whl.
File metadata
- Download URL: infisical_wrapper-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b396909131a29e1aeda5291f0fc5417c015bb8ec0e4a981afcf91fa554c98a48
|
|
| MD5 |
fc432781857cf848fe9857af1a0a9160
|
|
| BLAKE2b-256 |
c808e86b8bdadda8ad42050b67c52864ba9010d8a371358357b09fbc2e064e14
|