Skip to content

Flask REST parts 2-3: timezone-aware UTC timestamps and 200 on PUT - #904

Merged
realpython-bot merged 1 commit into
masterfrom
maintenance/flask-connexion-rest-utc-put-20261021
Oct 21, 2026
Merged

realpython-bot merged 1 commit into
masterfrom
maintenance/flask-connexion-rest-utc-put-20261021

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Follows up on #860 and #884 so the materials match the Part 2 and Part 3 update drafts (silent publish booked for 2026-10-25).

  • models.py (parts 2 and 3): datetime.utcnow is deprecated since Python 3.12, so timestamp now uses default=lambda: datetime.now(timezone.utc) and the same for onupdate. SQLite stores these as naive UTC, so the API output format is unchanged.
  • people.update() (parts 2 and 3) and notes.update() (part 3) return the default 200 instead of 201, which matches the "200" response that swagger.yml documents for PUT.

Verified on Python 3.14 with each folder's pinned requirements.txt: all people and notes endpoints, Swagger UI, and Uvicorn auto-reload.

🤖 Generated with Claude Code

…ST parts 2-3

Replace the deprecated datetime.utcnow with datetime.now(timezone.utc)
in the models, and return the default 200 from people/notes update()
to match the documented PUT response.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@realpython-bot
realpython-bot merged commit 9341e8e into master Oct 21, 2026
1 check passed
@realpython-bot
realpython-bot deleted the maintenance/flask-connexion-rest-utc-put-20261021 branch October 21, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant