Skip to content

Commit 8d2566c

Browse files
authored
Error in the Python Code Snippet
In the Python code snippet, the variable utc_now for Setting the Date header to our Date as a UTC String should be (line 431): utc_now = str(datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S ")) + "GMT" The day of the week %a is needed for the code to match the HMAC header format. The format should be Day of the week, Date Month Year CurrentTime. Example: Tue, 15 Mar 2022 00:27:47 GMT. Without this exact format, the Python REST API code does not work. This matches up with the documentation for Tutorial: Sign and make requests with Postman - https://docs.microsoft.com/en-us/azure/communication-services/tutorials/postman-tutorial.
1 parent 2d80cfb commit 8d2566c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

articles/azure-app-configuration/rest-api-authentication-hmac.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def sign_request(host,
428428
secret): # Access Key Value
429429
verb = method.upper()
430430

431-
utc_now = str(datetime.utcnow().strftime("%b, %d %Y %H:%M:%S ")) + "GMT"
431+
utc_now = str(datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S ")) + "GMT"
432432

433433
if six.PY2:
434434
content_digest = hashlib.sha256(bytes(body)).digest()

0 commit comments

Comments
 (0)