Skip to main content

Reads credentials from a yaml file

Project description

getsecret

Reads credentials from a file .getsecret.yaml

Install

pip install getsecret

Using

Create a file .getsecret.yaml. It should be in YAML format. An example follows:

username: foobar
password: supersecret

Now you can access those variables in your code as follows:

from getsecret import getsecret
username = getsecret('username')
password = getsecet('password')

Now the values of username and password are the ones specified in .getsecret.yaml (foobar and supersecret, respectively).

The file .getsecret.yaml can be located in the working directory (./.getsecret.yaml), or at the user's home directory (~/.getsecret.yaml)

If you pass an additional parameter, it will be used as the default if the key is not found in .getsecret.yaml. For example, the following will look for the username key in .getsecret.yaml, and will default to root if it is not found:

from getsecret import getsecret
username = getsecret('username', 'root')

Author

Geza Kovacs

License

MIT

Related

getsecret npm package for javascript on browser/nodejs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

getsecret-0.0.6.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

getsecret-0.0.6-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file getsecret-0.0.6.tar.gz.

File metadata

  • Download URL: getsecret-0.0.6.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4

File hashes

Hashes for getsecret-0.0.6.tar.gz
Algorithm Hash digest
SHA256 5580bc89f9e538c1cf7aba5c305440eea744f999ef23a47351cac0bca9b8b433
MD5 95b41e185d05f2e921a6ef8a9286693d
BLAKE2b-256 ada24c7b9f151a96c08adf72bd7f19cdd4bff86c087a117bc67b834e9b3de204

See more details on using hashes here.

File details

Details for the file getsecret-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: getsecret-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4

File hashes

Hashes for getsecret-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 502d5c3949590fb8c05b99d4001c0e340fda21eb274a5282b2532db1c9df318f
MD5 46f51bb20dce9439c213581b689b708c
BLAKE2b-256 af256571a67d6bceed84d0023353f5559aa46e02ebf6c9ab2cdaa1e9dbf00ea8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page