# 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
```powershell
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
```dotenv
# id
ID='dotenv_id'
# pw
PW='dotenv_pw'
ETC='etc_secret'
```
```python
from cred_retrieve import create_provider
cred = create_provider('dotenv')
print(cred.get_id_pw())
print(cred['ETC'])
```
### Example 2: Using KeePassXC Provider
```python
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:
```python
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](https://github.com/th-yoo/cred_retrieve/issues).
Raw data
{
"_id": null,
"home_page": "https://github.com/th-yoo/cred_retrieve",
"name": "cred_retrieve",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "secrets, credential, password, password storage, KeePassXC, dotenv",
"author": "th yoo",
"author_email": "taihyungyoo@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/01/cf/ccd76d3ffb9d26904bdc904d41436e38e2a02523e738bfc104095b538da5/cred_retrieve-0.1.3.tar.gz",
"platform": null,
"description": "# cred\\_retrieve\n**cred_retrieve** is a Python package that provides a flexible way to retrieve credentials from various sources, including KeePassXC and custom credential providers. \n\n## Installation\n```powershell\nPS > pip install cred_retrieve\n```\n\n## Usage\nYou can easily create a credential provider and retrieve credentials using the following examples.\n\n### Ecample 1: Using DotEnv Provider\n```dotenv\n# id\nID='dotenv_id'\n# pw\nPW='dotenv_pw'\nETC='etc_secret'\n```\n```python\nfrom cred_retrieve import create_provider\n\ncred = create_provider('dotenv')\nprint(cred.get_id_pw())\nprint(cred['ETC'])\n```\n\n### Example 2: Using KeePassXC Provider\n```python\nimport os\nfrom cred_retrieve import create_provider\n\n# Set the path to your KeePassXC database file\ndb = os.path.join(os.getenv('PROGRAMDATA'), 'KeePassXC', 'cred.kdbx')\n\n# Create a provider instance\ncred = create_provider('keepassxc', db)\n\n# Retrieve credentials\nusername, password = cred.get_id_pw('db_password', 'entry')\nprint(f'Username: {username}, Password: {password}')\n```\n\n### Example 3: Registering a Custom Provider\nYou can also create and register your own credential provider:\n```python\nfrom cred_retrieve import creators, CredentialProvider, create_provider\n\n# Define a custom provider\nclass TestProvider(CredentialProvider):\n def __init__(self):\n pass\n\n def get_id_pw(self):\n return 'test_id', 'test_pw'\n\n# Register the custom provider\ncreators().register('test', TestProvider)\n\n# Create an instance of the custom provider\np = create_provider('test')\n\n# Retrieve credentials from the custom provider\nusername, password = p.get_id_pw()\nprint(f'Username: {username}, Password: {password}')\n```\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n## Contact\nFor any questions or support, please reach out to me via [GitHub Issues](https://github.com/th-yoo/cred_retrieve/issues).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python package that provides a flexible way to retrieve credentials from various sources, including KeePassXC and custom credential providers.",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/th-yoo/cred_retrieve"
},
"split_keywords": [
"secrets",
" credential",
" password",
" password storage",
" keepassxc",
" dotenv"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ac7d9505ee69cb8aa049c7b1556e2e064256c86150263f0456fd44d6ec018d8d",
"md5": "4d22c999868562a4027836f4a3dc5a0f",
"sha256": "20f5978f9b77aad9e164da1aa9d2713fd30d9e3a9ddf1a4771451a14838387ff"
},
"downloads": -1,
"filename": "cred_retrieve-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4d22c999868562a4027836f4a3dc5a0f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 7439,
"upload_time": "2024-10-22T07:54:56",
"upload_time_iso_8601": "2024-10-22T07:54:56.958318Z",
"url": "https://files.pythonhosted.org/packages/ac/7d/9505ee69cb8aa049c7b1556e2e064256c86150263f0456fd44d6ec018d8d/cred_retrieve-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "01cfccd76d3ffb9d26904bdc904d41436e38e2a02523e738bfc104095b538da5",
"md5": "89e2abad21c1f000c5218dc619234fd5",
"sha256": "f8b01bc89bfb0b12c1728a85ab24d1dd90af31d3b6f697040e5d2c6225b5dd5a"
},
"downloads": -1,
"filename": "cred_retrieve-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "89e2abad21c1f000c5218dc619234fd5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 5200,
"upload_time": "2024-10-22T07:54:58",
"upload_time_iso_8601": "2024-10-22T07:54:58.427163Z",
"url": "https://files.pythonhosted.org/packages/01/cf/ccd76d3ffb9d26904bdc904d41436e38e2a02523e738bfc104095b538da5/cred_retrieve-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-22 07:54:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "th-yoo",
"github_project": "cred_retrieve",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cred_retrieve"
}