Skip to content

Instantly share code, notes, and snippets.

View adelosa's full-sized avatar

Anthony Delosa adelosa

View GitHub Profile
@adelosa
adelosa / db_test.py
Last active December 2, 2021 11:07
Python database unit testing class
import os
import tempfile
import unittest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from youapp.model import Base # replace this with your app's model base
"""
@adelosa
adelosa / kmsencrypt.py
Created September 26, 2016 09:36
AWS KMS + Python Cryptography using Fernet
#!/usr/bin/env python
"""
kmsencrypt.py
AWS kms + python Cryptography library file encrypt and decrypt
This will perform a file encryption and decryption using AWS KMS for generating a data key
rather than using the Fernet generate_key function.
Assumes that AWS access key, secret or token have been setup outside using credentials file or envvars