Skip to main content

No project description provided

Project description

buildVersion buildStatus MitLicense pythonVersion


A module for easily and securely storing and retriving API credentials in a database.

Storing API credentials locally in plaintext is a security anti-pattern. The goal of apikeystore is to create an easy to use module that will allow you to protect your credentials. It works by keeping the keys encrypted until your code executes.

import apikeystore as aks
import requests

#Create new vault
myvault = aks.Vault("Test-vault1.db")
myvault.new()

#Store an API credential in the vault
mycreds = aks.Creds(vaultName="Test-vault1.db")
credDetails = {
  'appName' : 'virusTotal',
  'urlBase' : 'https://www.virustotal.com/vtapi/v2/',
  'userId'  : '',
  'appKey'  : 'cf51cae902609f18f1f37b33c79eb9ad559c599d29441592e1ca1c4c48d175ab',
  'authType': 'basic'
}
mycreds.addCreds(**credDetails)

#Retreive and use API keys
mycreds = aks.Creds(vaultName="Test-vault1.db")
vtcred = mycreds.getCred(appName='virusTotal')
vtendpoint = vTcred['urlBase'] + 'file/report?'
payload = {
      'resource': '993dcc7f09c690c6f1d3049b3f66092451f2e82536cf81d15ceef447bc4b3b27',
      'apikey' : vTcred['appKey']
}

r = requests.get(vtendpoint, params=payload)
print(r.status_code)
#r.json()

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

apikeystore-0.0.10.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

apikeystore-0.0.10-py3-none-any.whl (5.9 kB view hashes)

Uploaded Python 3

Supported by

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