This is the sample code provided within the api documentation:
#!/bin/bash
apiKey="yourApiKey"
secret="yourSecret"
curl -i \
-X GET \
-H 'Accept:application/json' \
-H 'Api-key:'$apiKey'' \
-H 'X-Signature:'$(echo -n ${apiKey}${secret}$(date +%s)|sha256sum|awk '{ print $1}')'' \
https://api.test.hotelbeds.com/hotel-api/1.0/status
This is what I am doing in python:
secret = b"Secret key"
apikey = b"Api key"
datenow = str(datetime.datetime.now().timestamp())
datenow = bytes(datenow, 'utf-8')
sig = apikey + secret + datenow
hash = hashlib.sha256(sig).hexdigest()
However, I am getting an authentication error. Can someone please help me fix my code?