Timezone offset TypeError fixed
The previous implementation raised a TypeError
line 70, in iso_date_to_datetime
the_datetime = datetime(*(int(num) for num in nums), tzinfo=tzinfo)
TypeError: function takes at most 9 arguments (10 given)
when the ISO date string included a timezone offset.
This is now resolved by using datetime.fromisoformat, which correctly handles timezone-aware ISO strings.
if not tz_aware:
the_datetime = the_datetime.replace(tzinfo=None)
handles the tz_aware flag and ensures downward compatibility
added two Docstringtests for Offset
This fix is relevant for the usage in har2warc. har2warc fails with the above-mentioned error in the following lines:
https://github.com/webrecorder/har2warc/blob/dd1e29a0af018113ffbd19795ee6bc390b8889c2/har2warc/har2warc.py#L85-L87
This happens with .har files generated by firefox/librewolf as e.g. the one in the attached ZIP-file.
@FabioKn can you show us how you triggered this error? Was it reading a warc file, etc
Oh, I see that you work with @white-gecko and that is the trigger. Thanks.