Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Python 3
- import jwt # PyJWT
- import uuid
- import hashlib
- from urllib.parse import urlencode
- # query는 dict 타입입니다.
- m = hashlib.sha512()
- m.update(urlencode(query).encode())
- query_hash = m.hexdigest()
- payload = {
- 'access_key': '발급받은 Access Key',
- 'nonce': str(uuid.uuid4()),
- 'query_hash': query_hash,
- 'query_hash_alg': 'SHA512',
- }
- jwt_token = jwt.encode(payload, '발급받은 Secret Key',).decode('utf8')
- authorization_token = 'Bearer {}'.format(jwt_token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement