# Installing
```shell
$ pip install credentials
```
# Usage
## Default
Using default setup, this will try and load credentials first from the processes environement variables and then from `~/.credentials.json`
```python
from credentials import credentials
# load credentials up front
creds = credentials.require(['cred1', 'cred2'])
function_that_needs_creds(creds.cred1)
...
# load credentials as needed
my_cred = credentials.load('cred_3')
function_that_needs_creds(my_cred)
...
```
## Setting up your own loader
```python
# Only load credentias from environement
from credentials import Credentials, EnvBackend
creds = Credentials([EnvBackend()])
...
```
# Implementing your own backend
A backend is just an object with a `load` method. Method should take a `key` as an argument and return the associated credentials or `None` if it could not be loaded.
Example:
```python
class UniversalCredLoader(object):
def load(self, key):
return 42
...
from credentials import Credentials
creds = Credentials([UniversalCredLoader()])
cred.load('cred1')
>>> 42
```
Metadata
Release files for credentials 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| credentials-1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for credentials-1.1-py2.py3-none-any.whl |
Release files / credentials-1.1-py2.py3-none-any.whl
| Download URL | credentials-1.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
6c2d4ffaac5ca264b5c7a4daf64306a571e5f01193ddbc9d5d2b79bd6650133e
|
|
BLAKE2b-256 checksum How to use checksums |
45d6e0555289e0139895366dd67f6b000c6834fcba84f7728a93f95de18440f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for credentials 1.1
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.