Skip to content

fix: use timezone-aware UTC in web search example#670

Open
Ghraven wants to merge 1 commit into
ollama:mainfrom
Ghraven:fix/example-utcnow-deprecation
Open

fix: use timezone-aware UTC in web search example#670
Ghraven wants to merge 1 commit into
ollama:mainfrom
Ghraven:fix/example-utcnow-deprecation

Conversation

@Ghraven
Copy link
Copy Markdown

@Ghraven Ghraven commented May 21, 2026

Summary

Replace datetime.utcnow() in examples/web_search_gpt_oss_helper.py with datetime.now(timezone.utc).

Bug

The example helper builds Page.fetched_at timestamps with datetime.utcnow(), which is deprecated in Python 3.12 because it returns a naive datetime. Running the example on Python 3.12+ can emit deprecation warnings.

Before/After

Before:

fetched_at=datetime.utcnow()

After:

fetched_at=datetime.now(timezone.utc)

The value is still UTC, but now it is explicitly timezone-aware.

Verification

  • python -m compileall -q examples/web_search_gpt_oss_helper.py
  • git diff --check
  • rg -n 'datetime\.utcnow\(' examples/web_search_gpt_oss_helper.py returns no matches

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