Skip to main content

cred_retrieve

cred_retrieve is a Python package that provides a flexible way to retrieve credentials from various sources, including KeePassXC and custom credential providers.

Installation

PS > pip install cred_retrieve

Usage

You can easily create a credential provider and retrieve credentials using the following examples.

Ecample 1: Using DotEnv Provider

# id
ID='dotenv_id'
# pw
PW='dotenv_pw'
ETC='etc_secret'
from cred_retrieve import create_provider

cred = create_provider('dotenv')
print(cred.get_id_pw())
print(cred['ETC'])

Example 2: Using KeePassXC Provider

import os
from cred_retrieve import create_provider

# Set the path to your KeePassXC database file
db = os.path.join(os.getenv('PROGRAMDATA'), 'KeePassXC', 'cred.kdbx')

# Create a provider instance
cred = create_provider('keepassxc', db)

# Retrieve credentials
username, password = cred.get_id_pw('db_password', 'entry')
print(f'Username: {username}, Password: {password}')

Example 3: Registering a Custom Provider

You can also create and register your own credential provider:

from cred_retrieve import creators, CredentialProvider, create_provider

# Define a custom provider
class TestProvider(CredentialProvider):
    def __init__(self):
        pass

    def get_id_pw(self):
        return 'test_id', 'test_pw'

# Register the custom provider
creators().register('test', TestProvider)

# Create an instance of the custom provider
p = create_provider('test')

# Retrieve credentials from the custom provider
username, password = p.get_id_pw()
print(f'Username: {username}, Password: {password}')

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For any questions or support, please reach out to me via GitHub Issues.

Metadata

Release files for cred_retrieve 0.1.3

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

Source distribution (sdist)

Source distribution for cred_retrieve 0.1.3
File Size Uploaded
cred_retrieve-0.1.3.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cred_retrieve 0.1.3
File Interpreter ABI Platform
cred_retrieve-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / cred_retrieve-0.1.3.tar.gz

Download URL cred_retrieve-0.1.3.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f8b01bc89bfb0b12c1728a85ab24d1dd90af31d3b6f697040e5d2c6225b5dd5a
BLAKE2b-256 checksum
How to use checksums
01cfccd76d3ffb9d26904bdc904d41436e38e2a02523e738bfc104095b538da5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.7 Linux/6.5.0-1025-azure

Release files / cred_retrieve-0.1.3-py3-none-any.whl

Download URL cred_retrieve-0.1.3-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20f5978f9b77aad9e164da1aa9d2713fd30d9e3a9ddf1a4771451a14838387ff
BLAKE2b-256 checksum
How to use checksums
ac7d9505ee69cb8aa049c7b1556e2e064256c86150263f0456fd44d6ec018d8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.7 Linux/6.5.0-1025-azure

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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