-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Azure cosmos API is locale dependent when sending RFC 1123 dates #29109
Copy link
Copy link
Closed
Labels
Cosmoscustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.issue-addressedWorkflow: The Azure SDK team believes it to be addressed and ready to close.Workflow: The Azure SDK team believes it to be addressed and ready to close.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Metadata
Metadata
Assignees
Labels
Cosmoscustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.issue-addressedWorkflow: The Azure SDK team believes it to be addressed and ready to close.Workflow: The Azure SDK team believes it to be addressed and ready to close.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Describe the bug
Azure Cosmos API expects a RFC 1123 date format. When the format is wrong, we are receiving:
from the server.
Headers of the request are build within the library:
azure-sdk-for-python/sdk/cosmos/azure-cosmos/azure/cosmos/_base.py
Lines 240 to 241 in d33f020
The problem I have is that my personal locale is not English. It's Luxemburgish. That being said,
datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")will return a date with the given format that is following my localeDo, 02 Mär 2023 16:43:01 GMTinstead ofThu, 02 Mar 2023 16:43:01 GMTThis breaks the server and we get a
exceptions.CosmosHttpResponseErrorerror at the client level.To Reproduce
Steps to reproduce the behavior:
CosmosClientlist_databases()Expected behavior
I let you guys decide what would be the best way to fix that but personally I would either force the date generation with an hard coded locale (not the best) or make the locale transparent on the server side.
Hopefully I am being clear 😄