Skip to content

Commit 488b9de

Browse files
fix: Replace datetime.UTC with timezone.utc for Python compatibility
Fixed datetime.UTC usage which is only available in Python 3.11+. Replaced with datetime.timezone.utc for broader Python version compatibility. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0ddf851 commit 488b9de

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/snippets/servers/resource_contents_direct.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,11 @@ def get_logo() -> BlobResourceContents:
7575
async def get_metrics(metric_type: str) -> TextResourceContents:
7676
"""Return metrics data with metadata about collection time and source."""
7777
import datetime
78+
from datetime import timezone
7879

7980
# Simulate collecting metrics
8081
metrics = {"cpu": 45.2, "memory": 78.5, "disk": 62.1}
81-
timestamp = datetime.datetime.now(datetime.UTC).isoformat()
82+
timestamp = datetime.datetime.now(timezone.utc).isoformat()
8283

8384
if metric_type == "json":
8485
import json

0 commit comments

Comments
 (0)