Skip to content

fix: correct time format in Python quickstart#2117

Merged
jpoehnelt merged 3 commits into
googleworkspace:mainfrom
Marc416:fix/issue2115
Apr 19, 2025
Merged

fix: correct time format in Python quickstart#2117
jpoehnelt merged 3 commits into
googleworkspace:mainfrom
Marc416:fix/issue2115

Conversation

@Marc416

@Marc416 Marc416 commented Apr 9, 2025

Copy link
Copy Markdown
Contributor

Description

While testing the Calendar API using the Python quickstart guide, I noticed that the time formatting line appends a "Z" to a timezone-aware ISO string. This leads to an invalid ISO 8601 timestamp such as:

2025-04-07T14:39:12.345678+00:00Z

Appending "Z" to a string that already contains +00:00 (UTC offset) makes it invalid and may result in errors when calling the API.

Fix

Updated the time formatting line to remove the redundant "Z":

now = datetime.datetime.now(tz=datetime.timezone.utc).isoformat()

This ensures the timestamp remains valid and conforms to ISO 8601.

Fixes #2115

Has it been tested?

  • Development testing done
  • Unit or integration test implemented

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have performed a peer-reviewed with team member(s)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@Marc416 Marc416 changed the title fix : time format in Python quickstart for Calendar API fix(calendar): correct time format in Python quickstart Apr 9, 2025
@Marc416 Marc416 changed the title fix(calendar): correct time format in Python quickstart fix: correct time format in Python quickstart Apr 9, 2025
@Marc416 Marc416 marked this pull request as draft April 9, 2025 06:53
@Marc416 Marc416 marked this pull request as ready for review April 9, 2025 06:54
@Marc416

Marc416 commented Apr 9, 2025

Copy link
Copy Markdown
Contributor Author

I cannot add reviewers :( @jpoehnelt

@hillro500 hillro500 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixed an http error code 400 for me, and caused no other issues.

@Marc416

Marc416 commented Apr 16, 2025

Copy link
Copy Markdown
Contributor Author

@PierrickVoulet
Hi PierrickVoulet,
This is Marc. If you have some time, would you mind reviewing this PR?

@jpoehnelt jpoehnelt merged commit e4745e4 into googleworkspace:main Apr 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bugfix] Wrong ISO time format in Python quickstart for Calendar API

4 participants