Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

credentials

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

credentials

Credential Manager

  • 1.1
  • PyPI
  • Socket score

Maintainers
1

Build Status

Installing

$ 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

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

# 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:

class UniversalCredLoader(object):

   def load(self, key):
      return 42
...
from credentials import Credentials
creds = Credentials([UniversalCredLoader()])
cred.load('cred1')
>>> 42

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc