Created
March 9, 2020 20:48
-
-
Save trondhindenes/29ad057172b0c9480e5b555404fa3411 to your computer and use it in GitHub Desktop.
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
from hashlib import sha1 | |
import json | |
def generate_cache_key(start_url, role_name, account_id): | |
args = { | |
'startUrl': start_url, | |
'roleName': role_name, | |
'accountId': account_id, | |
} | |
args = json.dumps(args, sort_keys=True, separators=(',', ':')) | |
argument_hash = sha1(args.encode('utf-8')).hexdigest() | |
return argument_hash | |
hash = generate_cache_key('https://myorg.awsapps.com/start#/', 'AWSAdministratorAccess', '123123123123') | |
print(hash) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment