Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Feb 28, 2026. It is now read-only.
Make RFC parsing not dependent of locale - #201
Merged
Merged
Conversation
Laurent Mazuel (lmazuel)
requested a review
from Johan Stenberg (ex-msft) (johanste)May 6, 2020 23:58
Laurent Mazuel (lmazuel)
commented
May 7, 2020
MemberAuthor
Without the PR, trying to deserialize in a french VM: >>>frommsrest.serializationimportDeserializer>>>Deserializer.deserialize_rfc("Mon, 20 Nov 1995 19:12:08 -0500")
Traceback (mostrecentcalllast):
File"/home/lmazuel/rfctest/lib/python3.6/site-packages/msrest/serialization.py", line1818, indeserialize_rfcattr, "%a, %d %b %Y %H:%M:%S %Z")
File"/usr/lib/python3.6/_strptime.py", line565, in_strptime_datetimett, fraction=_strptime(data_string, format)
File"/usr/lib/python3.6/_strptime.py", line362, in_strptime
(data_string, format))
ValueError: timedata'Mon, 20 Nov 1995 19:12:08 -0500'doesnotmatchformat'%a, %d %b %Y %H:%M:%S %Z'Duringhandlingoftheaboveexception, anotherexceptionoccurred:
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"/home/lmazuel/rfctest/lib/python3.6/site-packages/msrest/serialization.py", line1823, indeserialize_rfcraise_with_traceback(DeserializationError, msg, err)
File"/home/lmazuel/rfctest/lib/python3.6/site-packages/msrest/exceptions.py", line51, inraise_with_tracebackraiseerror.with_traceback(exc_traceback)
File"/home/lmazuel/rfctest/lib/python3.6/site-packages/msrest/serialization.py", line1818, indeserialize_rfcattr, "%a, %d %b %Y %H:%M:%S %Z")
File"/usr/lib/python3.6/_strptime.py", line565, in_strptime_datetimett, fraction=_strptime(data_string, format)
File"/usr/lib/python3.6/_strptime.py", line362, in_strptime
(data_string, format))
msrest.exceptions.DeserializationError: Cannotdeserializetorfcdatetimeobject., ValueError: timedata'Mon, 20 Nov 1995 19:12:08 -0500'doesnotmatchformat'%a, %d %b %Y %H:%M:%S %Z'With the PR: >>>frommsrest.serializationimportDeserializer>>>Deserializer.deserialize_rfc("Mon, 20 Nov 1995 19:12:08 -0500")
datetime.datetime(1995, 11, 20, 19, 12, 8, tzinfo=<FixedOffset-5.0>) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix#192
Code inspired from the one I wrote for azure-core