Skip to content

fix: correct time format in Python quickstart #2117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 19, 2025

Conversation

Marc416
Copy link
Contributor

@Marc416 Marc416 commented Apr 9, 2025

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
Copy link
Contributor Author

Marc416 commented Apr 9, 2025

I cannot add reviewers :( @jpoehnelt

Copy link

@hillro500 hillro500 left a comment

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
Copy link
Contributor Author

Marc416 commented Apr 16, 2025

@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
8 of 9 checks passed
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