Skip to content

Instantly share code, notes, and snippets.

@taf2
Created August 1, 2021 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taf2/d239255de1599d2092c5c3618c622e25 to your computer and use it in GitHub Desktop.
Save taf2/d239255de1599d2092c5c3618c622e25 to your computer and use it in GitHub Desktop.
from hashlib import sha1;
import hmac;
import base64;
timestamp = '1350310273' # X-CTM-Time header
signature = 'A sample signature from CTM=' # X-CTM-Signature header
api_secret_key = 'your-api-key' # your secret key can be found in the account settings
msg = '{...}' # request body
mac = hmac.new(api_secret_key, timestamp, sha1)
mac.update(msg)
print base64.b64encode(mac.digest())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment