python-tado 0.19.1__tar.gz → 0.19.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: python-tado
3
- Version: 0.19.1
3
+ Version: 0.19.2
4
4
  Summary: PyTado from chrism0dwk, modified by w.malgadey, diplix, michaelarnauts, LenhartStephan, splifter, syssi, andersonshatch, Yippy, p0thi, Coffee2CodeNL, chiefdragon, FilBr, nikilase, albertomontesg, Moritz-Schmidt, palazzem
5
5
  License: GPL-3.0-or-later
6
6
  Keywords: tado
@@ -8,7 +8,7 @@ import logging
8
8
  import os
9
9
  import pprint
10
10
  import time
11
- from datetime import datetime, timedelta
11
+ from datetime import datetime, timedelta, timezone
12
12
  from json import dump as json_dump
13
13
  from json import load as json_load
14
14
  from pathlib import Path
@@ -174,7 +174,7 @@ class Http:
174
174
  else:
175
175
  _LOGGER.setLevel(logging.WARNING)
176
176
 
177
- self._refresh_at = datetime.now() + timedelta(minutes=10)
177
+ self._refresh_at = datetime.now(timezone.utc) + timedelta(minutes=10)
178
178
  self._session = http_session or self._create_session()
179
179
  self._session.hooks["response"].append(self._log_response)
180
180
  self._headers = {"Referer": "https://app.tado.com/"}
@@ -346,7 +346,7 @@ class Http:
346
346
  refresh_token = data["refresh_token"]
347
347
 
348
348
  self._token_refresh = refresh_token
349
- self._refresh_at = datetime.now()
349
+ self._refresh_at = datetime.now(timezone.utc)
350
350
  self._refresh_at = self._refresh_at + timedelta(seconds=expires_in)
351
351
  # We subtract 30 seconds from the correct refresh time.
352
352
  # Then we have a 30 seconds timespan to get a new refresh_token
@@ -396,7 +396,7 @@ class Http:
396
396
  and force_refresh is False.
397
397
  """
398
398
 
399
- if self._refresh_at >= datetime.now() and not force_refresh:
399
+ if self._refresh_at >= datetime.now(timezone.utc) and not force_refresh:
400
400
  return True
401
401
 
402
402
  url = "https://login.tado.com/oauth2/token"
@@ -506,7 +506,7 @@ class Http:
506
506
  _LOGGER.info("Please visit the following URL: %s", visit_url)
507
507
 
508
508
  expires_in_seconds = self._device_flow_data["expires_in"]
509
- self._expires_at = datetime.now() + timedelta(seconds=expires_in_seconds)
509
+ self._expires_at = datetime.now(timezone.utc) + timedelta(seconds=expires_in_seconds)
510
510
 
511
511
  _LOGGER.info(
512
512
  "Waiting for user to authorize the device. Expires at %s",
@@ -516,8 +516,10 @@ class Http:
516
516
  return DeviceActivationStatus.PENDING
517
517
 
518
518
  def _check_device_activation(self) -> bool:
519
- if self._expires_at is not None and datetime.timestamp(datetime.now()) > datetime.timestamp(
520
- self._expires_at
519
+ if (
520
+ self._expires_at is not None
521
+ and datetime.timestamp(datetime.now(timezone.utc))
522
+ > datetime.timestamp(self._expires_at)
521
523
  ):
522
524
  raise TadoException("User took too long to enter key")
523
525
 
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "python-tado"
7
- version = "0.19.1"
7
+ version = "0.19.2"
8
8
  description = "PyTado from chrism0dwk, modified by w.malgadey, diplix, michaelarnauts, LenhartStephan, splifter, syssi, andersonshatch, Yippy, p0thi, Coffee2CodeNL, chiefdragon, FilBr, nikilase, albertomontesg, Moritz-Schmidt, palazzem"
9
9
  authors = [
10
10
  "Chris Jewell <chrism0dwk@gmail.com>",
File without changes
File without changes
File without changes