Skip to content

Commit e226c14

Browse files
authored
fix deprecation of utcnow (#43916)
* fix deprecation of utcnow * Update CHANGELOG.md
1 parent 62e9e46 commit e226c14

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

sdk/appconfiguration/azure-appconfiguration/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
### Other Changes
1212

13+
- Replaced deprecated `datetime.utcnow()` with timezone-aware `datetime.now(timezone.utc)`.
14+
1315
## 1.7.2 (2025-10-20)
1416

1517
### Bugs Fixed

sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# license information.
55
# -------------------------------------------------------------------------
66

7-
from datetime import datetime
7+
from datetime import datetime, timezone
88
from typing import Optional, Tuple, Dict, Any
99

1010
# Connection string component prefixes
@@ -40,7 +40,7 @@ def parse_connection_string(connection_string: str) -> Tuple[str, str, str]:
4040

4141

4242
def get_current_utc_time() -> str:
43-
return str(datetime.utcnow().strftime("%b, %d %Y %H:%M:%S.%f ")) + "GMT"
43+
return str(datetime.now(timezone.utc).strftime("%b, %d %Y %H:%M:%S.%f ")) + "GMT"
4444

4545

4646
def get_key_filter(*args: Optional[str], **kwargs: Any) -> Tuple[Optional[str], Dict[str, Any]]:

0 commit comments

Comments
 (0)