(timestamp, message, api_key, secret_key, passphrase)
| 24 | |
| 25 | |
| 26 | def get_auth_headers(timestamp, message, api_key, secret_key, passphrase): |
| 27 | message = message.encode('ascii') |
| 28 | hmac_key = base64.b64decode(secret_key) |
| 29 | signature = hmac.new(hmac_key, message, hashlib.sha256) |
| 30 | signature_b64 = base64.b64encode(signature.digest()).decode('utf-8') |
| 31 | return { |
| 32 | 'Content-Type': 'Application/JSON', |
| 33 | 'CB-ACCESS-SIGN': signature_b64, |
| 34 | 'CB-ACCESS-TIMESTAMP': timestamp, |
| 35 | 'CB-ACCESS-KEY': api_key, |
| 36 | 'CB-ACCESS-PASSPHRASE': passphrase |
| 37 | } |