PyFunceble-dev 4.2.18__py3-none-any.whl → 4.2.19__py3-none-any.whl
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.
- PyFunceble/checker/availability/base.py +14 -14
- PyFunceble/checker/availability/domain.py +2 -2
- PyFunceble/checker/availability/domain_and_ip.py +3 -3
- PyFunceble/checker/base.py +26 -26
- PyFunceble/checker/params_base.py +1 -1
- PyFunceble/checker/reputation/base.py +16 -16
- PyFunceble/checker/reputation/domain_and_ip.py +3 -3
- PyFunceble/checker/syntax/domain_and_ip.py +1 -1
- PyFunceble/cli/continuous_integration/base.py +2 -2
- PyFunceble/cli/entry_points/pyfunceble/cli.py +13 -13
- PyFunceble/cli/execution_time.py +2 -2
- PyFunceble/cli/file_preloader.py +4 -4
- PyFunceble/cli/filesystem/printer/file.py +2 -2
- PyFunceble/cli/migrators/json2csv/inactive.py +5 -2
- PyFunceble/cli/processes/workers/base.py +6 -4
- PyFunceble/cli/processes/workers/producer.py +7 -7
- PyFunceble/cli/system/integrator.py +26 -2
- PyFunceble/cli/system/launcher.py +3 -3
- PyFunceble/cli/utils/version.py +5 -3
- PyFunceble/config/compare.py +8 -5
- PyFunceble/config/loader.py +3 -3
- PyFunceble/data/infrastructure/.PyFunceble_production.yaml +53 -8
- PyFunceble/dataset/autocontinue/csv.py +2 -2
- PyFunceble/dataset/autocontinue/sql.py +2 -2
- PyFunceble/dataset/csv_base.py +4 -2
- PyFunceble/dataset/inactive/csv.py +3 -3
- PyFunceble/dataset/inactive/sql.py +2 -2
- PyFunceble/dataset/sql_base.py +2 -2
- PyFunceble/dataset/whois/base.py +4 -2
- PyFunceble/dataset/whois/sql.py +2 -2
- PyFunceble/downloader/base.py +9 -7
- PyFunceble/query/{collection.py → platform.py} +205 -21
- PyFunceble/storage.py +2 -2
- {PyFunceble_dev-4.2.18.dist-info → PyFunceble_dev-4.2.19.dist-info}/METADATA +44 -40
- {PyFunceble_dev-4.2.18.dist-info → PyFunceble_dev-4.2.19.dist-info}/RECORD +39 -39
- {PyFunceble_dev-4.2.18.dist-info → PyFunceble_dev-4.2.19.dist-info}/WHEEL +1 -1
- {PyFunceble_dev-4.2.18.dist-info → PyFunceble_dev-4.2.19.dist-info}/LICENSE +0 -0
- {PyFunceble_dev-4.2.18.dist-info → PyFunceble_dev-4.2.19.dist-info}/entry_points.txt +0 -0
- {PyFunceble_dev-4.2.18.dist-info → PyFunceble_dev-4.2.19.dist-info}/top_level.txt +0 -0
@@ -190,14 +190,38 @@ class SystemIntegrator(SystemBase):
|
|
190
190
|
"both disabled."
|
191
191
|
)
|
192
192
|
|
193
|
-
if "url_base" in PyFunceble.storage.CONFIGURATION.
|
193
|
+
if "url_base" in PyFunceble.storage.CONFIGURATION.platform:
|
194
194
|
PyFunceble.cli.storage.EXTRA_MESSAGES.append(
|
195
195
|
f"{colorama.Style.BRIGHT}{colorama.Fore.MAGENTA}Your are still "
|
196
|
-
"defining the '
|
196
|
+
"defining the 'platform.url_base' configuration key which has "
|
197
197
|
"been deprecated and deleted. Please remove it from your "
|
198
198
|
"configuration file."
|
199
199
|
)
|
200
200
|
|
201
|
+
if (
|
202
|
+
"collection" in PyFunceble.storage.CONFIGURATION
|
203
|
+
or "collection" in PyFunceble.storage.CONFIGURATION.lookup
|
204
|
+
):
|
205
|
+
PyFunceble.cli.storage.EXTRA_MESSAGES.append(
|
206
|
+
f"{colorama.Style.BRIGHT}{colorama.Fore.MAGENTA}The 'collection' "
|
207
|
+
"configuration key is not supported anymore. Please switch to "
|
208
|
+
"'platform'."
|
209
|
+
)
|
210
|
+
|
211
|
+
if "PYFUNCEBLE_COLLECTION_API_TOKEN" in os.environ:
|
212
|
+
PyFunceble.cli.storage.EXTRA_MESSAGES.append(
|
213
|
+
f"{colorama.Style.BRIGHT}{colorama.Fore.MAGENTA}The "
|
214
|
+
"'PYFUNCEBLE_COLLECTION_API_TOKEN' environment variable is not "
|
215
|
+
"supported anymore. Please switch to 'PYFUNCEBLE_PLATFORM_API_TOKEN'."
|
216
|
+
)
|
217
|
+
|
218
|
+
if "PYFUNCEBLE_COLLECTION_API_URL" in os.environ:
|
219
|
+
PyFunceble.cli.storage.EXTRA_MESSAGES.append(
|
220
|
+
f"{colorama.Style.BRIGHT}{colorama.Fore.MAGENTA}The "
|
221
|
+
"'PYFUNCEBLE_COLLECTION_API_URL' environment variable is not "
|
222
|
+
"supported anymore. Please switch to 'PYFUNCEBLE_PLATFORM_API_URL'."
|
223
|
+
)
|
224
|
+
|
201
225
|
@SystemBase.ensure_args_is_given
|
202
226
|
def check_deprecated(self) -> "SystemIntegrator":
|
203
227
|
"""
|
@@ -120,7 +120,7 @@ from PyFunceble.dataset.inactive.base import InactiveDatasetBase
|
|
120
120
|
from PyFunceble.helpers.directory import DirectoryHelper
|
121
121
|
from PyFunceble.helpers.download import DownloadHelper
|
122
122
|
from PyFunceble.helpers.file import FileHelper
|
123
|
-
from PyFunceble.query.
|
123
|
+
from PyFunceble.query.platform import PlatformQueryTool
|
124
124
|
|
125
125
|
|
126
126
|
class SystemLauncher(SystemBase):
|
@@ -499,7 +499,7 @@ class SystemLauncher(SystemBase):
|
|
499
499
|
cleanup_tool.clean_output_files()
|
500
500
|
running_file_helper.write(
|
501
501
|
f"{self.sessions_id[parent_dirname]} "
|
502
|
-
f"{datetime.datetime.
|
502
|
+
f"{datetime.datetime.now(datetime.timezone.utc).isoformat()}",
|
503
503
|
overwrite=True,
|
504
504
|
)
|
505
505
|
else:
|
@@ -643,7 +643,7 @@ class SystemLauncher(SystemBase):
|
|
643
643
|
testing.
|
644
644
|
"""
|
645
645
|
|
646
|
-
query_tool =
|
646
|
+
query_tool = PlatformQueryTool()
|
647
647
|
|
648
648
|
max_breakoff = 120.0
|
649
649
|
breakoff_multiplier = 0.5
|
PyFunceble/cli/utils/version.py
CHANGED
@@ -52,7 +52,7 @@ License:
|
|
52
52
|
|
53
53
|
import os
|
54
54
|
import sys
|
55
|
-
from datetime import datetime
|
55
|
+
from datetime import datetime, timezone
|
56
56
|
|
57
57
|
import colorama
|
58
58
|
from box import Box
|
@@ -292,7 +292,7 @@ def handle_messages(upstream_version: Box) -> None:
|
|
292
292
|
authorized = True
|
293
293
|
|
294
294
|
if authorized:
|
295
|
-
local_timezone = datetime.
|
295
|
+
local_timezone = datetime.now(timezone.utc).astimezone().tzinfo
|
296
296
|
|
297
297
|
for minimal_version, data in upstream_version.messages.items():
|
298
298
|
if not version_utility.is_equal_to(
|
@@ -357,5 +357,7 @@ def print_central_messages(check_force_update: bool = False) -> None:
|
|
357
357
|
|
358
358
|
handle_messages(upstream_version)
|
359
359
|
|
360
|
+
prefix = " - " if len(PyFunceble.cli.storage.EXTRA_MESSAGES) > 1 else ""
|
361
|
+
|
360
362
|
for extra_message in PyFunceble.cli.storage.EXTRA_MESSAGES:
|
361
|
-
print_single_line(extra_message, force=True)
|
363
|
+
print_single_line(prefix + extra_message, force=True, end="\n")
|
PyFunceble/config/compare.py
CHANGED
@@ -135,6 +135,9 @@ class ConfigComparison:
|
|
135
135
|
"whois_database": "cli_testing.whois_db",
|
136
136
|
"wildcard": "cli_decoding.wildcard",
|
137
137
|
"cli_decoding.adblock_aggressive": "cli_decoding.aggressive",
|
138
|
+
"lookup.collection": "lookup.platform",
|
139
|
+
"collection.push": "platform.push",
|
140
|
+
"collection.preferred_status_origin": "platform.preferred_status_origin",
|
138
141
|
}
|
139
142
|
|
140
143
|
OLD_TO_NEW_NEGATE: dict = {
|
@@ -144,7 +147,7 @@ class ConfigComparison:
|
|
144
147
|
}
|
145
148
|
|
146
149
|
DELETE_FLATTEN: List[str] = [
|
147
|
-
"
|
150
|
+
"platform.url_base",
|
148
151
|
]
|
149
152
|
|
150
153
|
NEW_STATUS_CODES: dict = {
|
@@ -267,8 +270,8 @@ class ConfigComparison:
|
|
267
270
|
or "proxy" not in self.local_config
|
268
271
|
or "follow_server_order" not in self.local_config["dns"]
|
269
272
|
or "trust_server" not in self.local_config["dns"]
|
270
|
-
or "
|
271
|
-
or "
|
273
|
+
or "platform" not in self.local_config
|
274
|
+
or "platform" not in self.local_config["lookup"]
|
272
275
|
):
|
273
276
|
return False
|
274
277
|
|
@@ -293,8 +296,8 @@ class ConfigComparison:
|
|
293
296
|
return False
|
294
297
|
|
295
298
|
if (
|
296
|
-
"
|
297
|
-
and "url_base" in self.local_config["
|
299
|
+
"platform" in self.local_config
|
300
|
+
and "url_base" in self.local_config["platform"]
|
298
301
|
):
|
299
302
|
return False
|
300
303
|
|
PyFunceble/config/loader.py
CHANGED
@@ -435,8 +435,8 @@ class ConfigLoader:
|
|
435
435
|
PyFunceble.storage.HTTP_CODES = Box(
|
436
436
|
config["http_codes"],
|
437
437
|
)
|
438
|
-
if "
|
439
|
-
PyFunceble.storage.
|
438
|
+
if "platform" in config and config["platform"]:
|
439
|
+
PyFunceble.storage.PLATFORM = Box(config["platform"])
|
440
440
|
PyFunceble.storage.LINKS = Box(config["links"])
|
441
441
|
|
442
442
|
if "proxy" in config and config["proxy"]:
|
@@ -455,7 +455,7 @@ class ConfigLoader:
|
|
455
455
|
)
|
456
456
|
PyFunceble.storage.FLATTEN_CONFIGURATION = {}
|
457
457
|
PyFunceble.storage.HTTP_CODES = Box({})
|
458
|
-
PyFunceble.storage.
|
458
|
+
PyFunceble.storage.PLATFORM = Box({})
|
459
459
|
PyFunceble.storage.LINKS = Box({})
|
460
460
|
PyFunceble.storage.PROXY = Box({})
|
461
461
|
except (AttributeError, TypeError): # pragma: no cover ## Safety.
|
@@ -240,8 +240,8 @@ lookup:
|
|
240
240
|
# Activates the usage of the reputation data reputation.
|
241
241
|
reputation: no
|
242
242
|
|
243
|
-
# Activate the usage of the
|
244
|
-
|
243
|
+
# Activate the usage of the platform to lookup status.
|
244
|
+
platform: no
|
245
245
|
|
246
246
|
# Sets the timeout to apply to each of our lookup tools who support a timeout
|
247
247
|
# option.
|
@@ -424,21 +424,66 @@ links:
|
|
424
424
|
api_date_format: "https://pyfunceble.funilrys.com/api/date-format"
|
425
425
|
api_no_referrer: "https://pyfunceble.funilrys.com/api/no-referrer"
|
426
426
|
|
427
|
-
|
428
|
-
# Provides everything related to the
|
427
|
+
platform:
|
428
|
+
# Provides everything related to the platform.
|
429
429
|
|
430
|
-
# Activates the push of dataset into the
|
430
|
+
# Activates the push of dataset into the platform.
|
431
431
|
# WARNING: This is useless, if you don't have an API Token set as the
|
432
|
-
#
|
432
|
+
# PYFUNCEBLE_PLATFORM_API_TOKEN environment variable.
|
433
433
|
push: no
|
434
434
|
|
435
435
|
# Sets the preferred pull origin.
|
436
436
|
#
|
437
|
+
# When choosing `recommended`, the system will pull the recommended status
|
438
|
+
# that is provided and calculated by the platform.
|
439
|
+
#
|
437
440
|
# When choosing, `frequent`, the system will pull the most frequent status
|
438
|
-
# that is provided and calculated by the
|
441
|
+
# that is provided and calculated by the platform.
|
439
442
|
#
|
440
443
|
# When choosing, `latest`, the system will pull the latest status that is
|
441
|
-
# provided and available into the
|
444
|
+
# provided and available into the platform.
|
442
445
|
#
|
443
446
|
# Available: frequent | latest | recommended
|
444
447
|
preferred_status_origin: recommended
|
448
|
+
|
449
|
+
# Defines the checker type to prioritize when trying to fullfil platform
|
450
|
+
# contracts.
|
451
|
+
#
|
452
|
+
# Notes:
|
453
|
+
# 1. This is a list. The order matters.
|
454
|
+
# 2. One can overwrite this value, by settings a comma separated list of
|
455
|
+
# checker type to prioritize through the PYFUNCEBLE_PLATFORM_CHECKER_PRIORITY
|
456
|
+
# environment variable.
|
457
|
+
# 3. When set to `none`, the platform will throw a random contract at us.
|
458
|
+
#
|
459
|
+
# Example:
|
460
|
+
# Prioritize availability checker until no contract is available, then
|
461
|
+
# prioritize syntax checker until no contract is available, then prioritize
|
462
|
+
# reputation checker until no contract is available.
|
463
|
+
#
|
464
|
+
# - availability
|
465
|
+
# - syntax
|
466
|
+
# - reputation
|
467
|
+
#
|
468
|
+
# Available: none | availability | reputation | syntax
|
469
|
+
checker_priority:
|
470
|
+
- none
|
471
|
+
|
472
|
+
# Defines the checker type to exclude when trying to fullfil platform
|
473
|
+
# contracts.
|
474
|
+
#
|
475
|
+
# Notes:
|
476
|
+
# 1. This is a list.
|
477
|
+
# 2. One can overwrite this value, by settings a comma separated list of
|
478
|
+
# checker type to exclude through the PYFUNCEBLE_PLATFORM_CHECKER_EXCLUDE
|
479
|
+
# environment variable.
|
480
|
+
# 3. When set to `none`, no checker type will be excluded.
|
481
|
+
#
|
482
|
+
# Example:
|
483
|
+
# Exclude the reputation checker from the list of checker to use to fullfil.
|
484
|
+
#
|
485
|
+
# - reputation
|
486
|
+
#
|
487
|
+
# Available: none | availability | reputation | syntax
|
488
|
+
checker_exclude:
|
489
|
+
- none
|
@@ -52,7 +52,7 @@ License:
|
|
52
52
|
|
53
53
|
import functools
|
54
54
|
import os
|
55
|
-
from datetime import datetime
|
55
|
+
from datetime import datetime, timezone
|
56
56
|
from typing import Any, Generator, Optional, Tuple
|
57
57
|
|
58
58
|
import PyFunceble.cli.storage
|
@@ -179,7 +179,7 @@ class CSVContinueDataset(CSVDatasetBase, ContinueDatasetBase):
|
|
179
179
|
min_days = 365.25 * 20
|
180
180
|
|
181
181
|
for data in self.get_filtered_content({"session_id": session_id}):
|
182
|
-
if (datetime.
|
182
|
+
if (datetime.now(timezone.utc) - data["tested_at"]).days < min_days:
|
183
183
|
continue
|
184
184
|
|
185
185
|
if not data["idna_subject"]:
|
@@ -50,7 +50,7 @@ License:
|
|
50
50
|
limitations under the License.
|
51
51
|
"""
|
52
52
|
|
53
|
-
from datetime import datetime, timedelta
|
53
|
+
from datetime import datetime, timedelta, timezone
|
54
54
|
from typing import Generator, Tuple
|
55
55
|
|
56
56
|
import PyFunceble.cli.factory
|
@@ -94,7 +94,7 @@ class SQLDBContinueDataset(SQLDBDatasetBase, ContinueDatasetBase):
|
|
94
94
|
|
95
95
|
@SQLDBDatasetBase.execute_if_authorized(None)
|
96
96
|
def get_to_test(self, session_id: str) -> Generator[Tuple[str], str, None]:
|
97
|
-
twenty_years_ago = datetime.
|
97
|
+
twenty_years_ago = datetime.now(timezone.utc) - timedelta(days=365.25 * 20)
|
98
98
|
|
99
99
|
result = (
|
100
100
|
self.db_session.query(self.ORM_OBJ)
|
PyFunceble/dataset/csv_base.py
CHANGED
@@ -52,7 +52,7 @@ License:
|
|
52
52
|
|
53
53
|
import csv
|
54
54
|
import tempfile
|
55
|
-
from datetime import datetime, timedelta
|
55
|
+
from datetime import datetime, timedelta, timezone
|
56
56
|
from typing import Generator, Optional, Tuple
|
57
57
|
|
58
58
|
import PyFunceble.facility
|
@@ -210,7 +210,9 @@ class CSVDatasetBase(DBDatasetBase):
|
|
210
210
|
try:
|
211
211
|
row["tested_at"] = datetime.fromisoformat(row["tested_at"])
|
212
212
|
except (TypeError, ValueError):
|
213
|
-
row["tested_at"] = datetime.
|
213
|
+
row["tested_at"] = datetime.now(timezone.utc) - timedelta(
|
214
|
+
days=365
|
215
|
+
)
|
214
216
|
|
215
217
|
yield row
|
216
218
|
|
@@ -51,7 +51,7 @@ License:
|
|
51
51
|
"""
|
52
52
|
|
53
53
|
import os
|
54
|
-
from datetime import datetime, timedelta
|
54
|
+
from datetime import datetime, timedelta, timezone
|
55
55
|
from typing import Generator, Optional, Tuple
|
56
56
|
|
57
57
|
import PyFunceble.cli.storage
|
@@ -77,7 +77,7 @@ class CSVInactiveDataset(CSVDatasetBase, InactiveDatasetBase):
|
|
77
77
|
def get_to_retest(
|
78
78
|
self, destination: str, checker_type: str, *, min_days: Optional[int]
|
79
79
|
) -> Generator[Tuple[str, str, Optional[int]], dict, None]:
|
80
|
-
days_ago = datetime.
|
80
|
+
days_ago = datetime.now(timezone.utc) - timedelta(days=min_days)
|
81
81
|
|
82
82
|
for dataset in self.get_filtered_content(
|
83
83
|
{"destination": destination, "checker_type": checker_type}
|
@@ -86,7 +86,7 @@ class CSVInactiveDataset(CSVDatasetBase, InactiveDatasetBase):
|
|
86
86
|
try:
|
87
87
|
date_of_inclusion = datetime.fromisoformat(dataset["tested_at"])
|
88
88
|
except (TypeError, ValueError):
|
89
|
-
date_of_inclusion = datetime.
|
89
|
+
date_of_inclusion = datetime.now(timezone.utc) - timedelta(days=365)
|
90
90
|
else:
|
91
91
|
date_of_inclusion = dataset["tested_at"]
|
92
92
|
|
@@ -50,7 +50,7 @@ License:
|
|
50
50
|
limitations under the License.
|
51
51
|
"""
|
52
52
|
|
53
|
-
from datetime import datetime, timedelta
|
53
|
+
from datetime import datetime, timedelta, timezone
|
54
54
|
from typing import Generator, Optional, Tuple
|
55
55
|
|
56
56
|
from PyFunceble.database.sqlalchemy.all_schemas import Inactive
|
@@ -71,7 +71,7 @@ class SQLDBInactiveDataset(SQLDBDatasetBase, InactiveDatasetBase):
|
|
71
71
|
def get_to_retest(
|
72
72
|
self, destination: str, checker_type: str, *, min_days: Optional[int]
|
73
73
|
) -> Generator[Tuple[str, str, Optional[int]], dict, None]:
|
74
|
-
days_ago = datetime.
|
74
|
+
days_ago = datetime.now(timezone.utc) - timedelta(days=min_days)
|
75
75
|
|
76
76
|
result = (
|
77
77
|
self.db_session.query(self.ORM_OBJ)
|
PyFunceble/dataset/sql_base.py
CHANGED
@@ -51,7 +51,7 @@ License:
|
|
51
51
|
"""
|
52
52
|
|
53
53
|
import functools
|
54
|
-
from datetime import datetime
|
54
|
+
from datetime import datetime, timezone
|
55
55
|
from typing import Any, Generator, Optional
|
56
56
|
|
57
57
|
import sqlalchemy.exc
|
@@ -306,7 +306,7 @@ class SQLDBDatasetBase(DBDatasetBase):
|
|
306
306
|
raise exception
|
307
307
|
|
308
308
|
y2k38_limit = datetime(2037, 12, 31, 0, 0)
|
309
|
-
new_date = datetime.fromtimestamp(float(row["epoch"]))
|
309
|
+
new_date = datetime.fromtimestamp(float(row["epoch"]), timezone.utc)
|
310
310
|
new_date -= new_date - y2k38_limit
|
311
311
|
|
312
312
|
row["epoch"] = new_date.timestamp()
|
PyFunceble/dataset/whois/base.py
CHANGED
@@ -50,7 +50,7 @@ License:
|
|
50
50
|
limitations under the License.
|
51
51
|
"""
|
52
52
|
|
53
|
-
from datetime import datetime
|
53
|
+
from datetime import datetime, timezone
|
54
54
|
from typing import List, Union
|
55
55
|
|
56
56
|
from PyFunceble.database.sqlalchemy.all_schemas import WhoisRecord
|
@@ -85,7 +85,9 @@ class WhoisDatasetBase(DBDatasetBase):
|
|
85
85
|
else:
|
86
86
|
return True
|
87
87
|
|
88
|
-
return datetime.
|
88
|
+
return datetime.now(timezone.utc) > datetime.fromtimestamp(
|
89
|
+
float(to_check), timezone.utc
|
90
|
+
)
|
89
91
|
|
90
92
|
@DBDatasetBase.execute_if_authorized(None)
|
91
93
|
def get_filtered_row(self, row: Union[dict, WhoisRecord]) -> dict:
|
PyFunceble/dataset/whois/sql.py
CHANGED
@@ -50,7 +50,7 @@ License:
|
|
50
50
|
limitations under the License.
|
51
51
|
"""
|
52
52
|
|
53
|
-
from datetime import datetime
|
53
|
+
from datetime import datetime, timezone
|
54
54
|
from typing import Any, Generator, Optional, Union
|
55
55
|
|
56
56
|
import sqlalchemy
|
@@ -161,7 +161,7 @@ class SQLDBWhoisDataset(SQLDBDatasetBase, WhoisDatasetBase):
|
|
161
161
|
in the past.
|
162
162
|
"""
|
163
163
|
|
164
|
-
current_timestamp = int(datetime.
|
164
|
+
current_timestamp = int(datetime.now(timezone.utc).timestamp())
|
165
165
|
|
166
166
|
try:
|
167
167
|
self.db_session.query(self.ORM_OBJ).filter(
|
PyFunceble/downloader/base.py
CHANGED
@@ -226,7 +226,7 @@ class DownloaderBase:
|
|
226
226
|
Sets the current datetime into our registry.
|
227
227
|
"""
|
228
228
|
|
229
|
-
current_datetime = datetime.datetime.
|
229
|
+
current_datetime = datetime.datetime.now(datetime.timezone.utc)
|
230
230
|
|
231
231
|
self.all_downtimes[self.DOWNTIME_INDEX] = {
|
232
232
|
"iso": current_datetime.isoformat(),
|
@@ -253,19 +253,21 @@ class DownloaderBase:
|
|
253
253
|
return True
|
254
254
|
|
255
255
|
last_downloaded_time = datetime.datetime.fromtimestamp(
|
256
|
-
self.get_current_downtime()["timestamp"]
|
256
|
+
self.get_current_downtime()["timestamp"], datetime.timezone.utc
|
257
257
|
)
|
258
258
|
|
259
259
|
if (
|
260
260
|
self.DOWNLOAD_FREQUENCY <= 0
|
261
|
-
and (
|
261
|
+
and (
|
262
|
+
datetime.datetime.now(datetime.timezone.utc) - last_downloaded_time
|
263
|
+
).seconds
|
264
|
+
< 3600
|
262
265
|
):
|
263
266
|
return False
|
264
267
|
|
265
|
-
if (
|
266
|
-
|
267
|
-
|
268
|
-
):
|
268
|
+
if last_downloaded_time + datetime.timedelta(
|
269
|
+
days=self.DOWNLOAD_FREQUENCY
|
270
|
+
) <= datetime.datetime.now(datetime.timezone.utc):
|
269
271
|
return True
|
270
272
|
|
271
273
|
return False
|