Skip to content

Instantly share code, notes, and snippets.

@trondhindenes
Created March 9, 2020 20:48
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 trondhindenes/29ad057172b0c9480e5b555404fa3411 to your computer and use it in GitHub Desktop.
Save trondhindenes/29ad057172b0c9480e5b555404fa3411 to your computer and use it in GitHub Desktop.
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