Skip to main content

Infisical Secrets Wrapper

A clean, Pythonic wrapper around the Infisical SDK with:

  • automatic environment validation
  • client initialisation
  • fetch secrets for a given 'project'
  • fetch a single-secret
  • clean error handling

Purpose

  • A tool for the Homelab'er to use as a unified and simple way to get secrets into python scripts.
  • This is not production grade - Infisical provides methods for that.
  • Keep Dry. Reduces a lot of the verbosity and repetition required for the sdk to reliably pull secrets.
  • Keep Simple.
  • 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() # optional mgr = Infisical(debug=True)
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)

Limitations

  • Only fetches secrets presently.
  • Future releases will create & update (delete will not be supported).

License

MIT License

Metadata

Release files for infisical-wrapper 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for infisical-wrapper 1.0.2
File Size Uploaded Provenance Actions
infisical_wrapper-1.0.2.tar.gz 6.2 kB Without provenance Details for infisical_wrapper-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for infisical-wrapper 1.0.2
File Interpreter ABI Platform Actions
infisical_wrapper-1.0.2-py3-none-any.whl Python 3 none any Details for infisical_wrapper-1.0.2-py3-none-any.whl

Total release size: 12.7 kB

Release files / infisical_wrapper-1.0.2.tar.gz

Download URL infisical_wrapper-1.0.2.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3760fdd0dba541ec2b76fca2a4855e86c92ce9adc260e313e237a13670ad6718
BLAKE2b-256 checksum
How to use checksums
6eea9fda2744645f6d51b73178d4ddabd57b8400ee162dbd8e7ed9f2da010fcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / infisical_wrapper-1.0.2-py3-none-any.whl

Download URL infisical_wrapper-1.0.2-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa2f5737ec00cbdb4e3ef3cab715879567bce61a793fa477fe738641e263a6b9
BLAKE2b-256 checksum
How to use checksums
a0f0538e91c2bb2c9fccb1a9a31a3c37d79f595b742badfc4803f927b2e36e75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for infisical-wrapper 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page