No project description provided
Project description
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
Release history Release notifications | RSS feed
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 details)
Built Distribution
File details
Details for the file apikeystore-0.0.10.tar.gz
.
File metadata
- Download URL: apikeystore-0.0.10.tar.gz
- Upload date:
- Size: 6.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/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 466cf2df1e8cf959297b07c4398b34d7d68d5cc8b4e5466b807616317c7fc54e |
|
MD5 | 3c2755eaf6d8f5542e26fecba78a0e5b |
|
BLAKE2b-256 | 7eea9a6114b9fa1b0a6313f62426b59594fc5023cdda174e2f2b2a14f8a41301 |
File details
Details for the file apikeystore-0.0.10-py3-none-any.whl
.
File metadata
- Download URL: apikeystore-0.0.10-py3-none-any.whl
- Upload date:
- Size: 5.9 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/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd7352befccfde4e74d2690a3002606892d12035998368bc86472dd7f637325f |
|
MD5 | 6f1f571d5daa37040c41e77a8e6d433a |
|
BLAKE2b-256 | 01c35d726eae949d5f320bf12f1b865d416fd61ebafc230b5d1f0ec388de216d |