Skip to content

Commit b736630

Browse files
authored
Update ms_intune_apple_vpp_tokens.py
Replaced datetime.strptime with datetime.fromisoformat
1 parent db5c9dd commit b736630

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

intune/agent_based/ms_intune_apple_vpp_tokens.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import json
2222
from collections.abc import Mapping, Sequence
2323
from dataclasses import dataclass
24-
from datetime import datetime, timezone
24+
from datetime import datetime
2525
from typing import Any
2626

2727
from cmk.agent_based.v2 import (
@@ -90,8 +90,8 @@ def check_ms_intune_apple_vpp_tokens(item: str, params: Mapping[str, Any], secti
9090
token_state = token["token_state"]
9191
token_expiration = token["token_expiration"]
9292

93-
token_expiration_datetime_utc = datetime.strptime(token_expiration, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc)
94-
token_expiration_timestamp = token_expiration_datetime_utc.timestamp()
93+
token_expiration_datetime = datetime.fromisoformat(token_expiration)
94+
token_expiration_timestamp = token_expiration_datetime.timestamp()
9595
token_expiration_timestamp_render = render.datetime(int(token_expiration_timestamp))
9696

9797
token_expiration_timespan = token_expiration_timestamp - datetime.now().timestamp()

0 commit comments

Comments
 (0)