Created
August 16, 2017 21:09
-
-
Save UnquietCode/b0840638daeefa3ace36d550b80ff78f to your computer and use it in GitHub Desktop.
generate AWS SES email credentials in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on: | |
# https://charleslavery.com/notes/aws-ses-smtp-password-from-secret-key-python.html | |
import hashlib | |
import hmac | |
import base64 | |
key = bytes('aws-secret-access-key').encode('utf-8') | |
message = bytes('SendRawEmail').encode('utf-8') | |
versionInBytes = bytes('\x02') | |
signatureInBytes = hmac.new(key, message, digestmod=hashlib.sha256).digest() | |
signatureAndVer = versionInBytes + signatureInBytes | |
smtpPassword = base64.b64encode(signatureAndVer) | |
print(smtpPassword) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment