fix: replace deprecated utcnow() with datetime.now(timezone.utc)
Deploy via Portainer / deploy (push) Successful in 0s
Deploy via Portainer / deploy (push) Successful in 0s
This commit is contained in:
Binary file not shown.
@@ -4,7 +4,7 @@ try:
|
||||
import requests as _requests
|
||||
except ImportError:
|
||||
_requests = None
|
||||
from datetime import datetime, timedelta, date as date_cls
|
||||
from datetime import datetime, timedelta, date as date_cls, timezone
|
||||
from authlib.integrations.flask_client import OAuth
|
||||
|
||||
app = Flask(__name__)
|
||||
@@ -1938,7 +1938,7 @@ def calendar_ics():
|
||||
ORDER BY cb.date''').fetchall()
|
||||
conn.close()
|
||||
|
||||
now_str = datetime.utcnow().strftime('%Y%m%dT%H%M%SZ')
|
||||
now_str = datetime.now(timezone.utc).strftime('%Y%m%dT%H%M%SZ')
|
||||
lines = [
|
||||
'BEGIN:VCALENDAR',
|
||||
'VERSION:2.0',
|
||||
@@ -2044,8 +2044,8 @@ def _ha_sync_once():
|
||||
"SELECT id, name, ha_entity_prefix FROM printers "
|
||||
"WHERE ha_entity_prefix IS NOT NULL AND ha_entity_prefix != ''"
|
||||
).fetchall()
|
||||
now_iso = datetime.utcnow().isoformat()
|
||||
window = (datetime.utcnow() + timedelta(minutes=30)).isoformat()
|
||||
now_iso = datetime.now(timezone.utc).replace(tzinfo=None).isoformat()
|
||||
window = (datetime.now(timezone.utc).replace(tzinfo=None) + timedelta(minutes=30)).isoformat()
|
||||
for p in printers:
|
||||
prefix = p['ha_entity_prefix']
|
||||
ha_status = states.get(f'sensor.{prefix}_etat_de_l_impression', 'unknown')
|
||||
|
||||
Reference in New Issue
Block a user