labfreed 0.2.7__tar.gz → 0.2.8a0__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.
Potentially problematic release.
This version of labfreed might be problematic. Click here for more details.
- {labfreed-0.2.7 → labfreed-0.2.8a0}/PKG-INFO +1 -1
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/__init__.py +1 -1
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_id_resolver/services.py +11 -8
- {labfreed-0.2.7 → labfreed-0.2.8a0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/.github/workflows/pypi-publish.yml +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/.github/workflows/run-tests.yml +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/CHANGELOG.md +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/LICENSE +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/README.md +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/labfreed_infrastructure.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_cat/__init__.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_cat/category_base.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_cat/pac_cat.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_cat/predefined_categories.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_id/__init__.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_id/extension.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_id/id_segment.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_id/pac_id.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_id/url_parser.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_id/url_serializer.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_id_resolver/__init__.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_id_resolver/cit_common.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_id_resolver/cit_v1.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_id_resolver/cit_v2.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/pac_id_resolver/resolver.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/qr/__init__.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/qr/generate_qr.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/trex/__init__.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/trex/python_convenience/__init__.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/trex/python_convenience/data_table.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/trex/python_convenience/pyTREX.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/trex/python_convenience/quantity.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/trex/table_segment.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/trex/trex.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/trex/trex_base_models.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/trex/value_segments.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/utilities/base36.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/well_known_extensions/__init__.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/well_known_extensions/default_extension_interpreters.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/well_known_extensions/display_name_extension.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/well_known_extensions/trex_extension.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/well_known_keys/gs1/__init__.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/well_known_keys/gs1/gs1.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/well_known_keys/gs1/gs1_ai_enum_sorted.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/well_known_keys/labfreed/well_known_keys.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/well_known_keys/unece/UneceUnits.json +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/well_known_keys/unece/__init__.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/well_known_keys/unece/unece_units.py +0 -0
- {labfreed-0.2.7 → labfreed-0.2.8a0}/pyproject.toml +0 -0
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
from enum import auto, Enum
|
|
3
3
|
|
|
4
4
|
from pydantic import Field
|
|
5
|
-
|
|
5
|
+
import requests
|
|
6
6
|
|
|
7
7
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
8
8
|
|
|
9
|
+
import requests
|
|
9
10
|
from rich import print
|
|
10
11
|
from rich.table import Table
|
|
11
12
|
|
|
@@ -24,15 +25,17 @@ class Service(LabFREED_BaseModel):
|
|
|
24
25
|
url:str
|
|
25
26
|
status:ServiceStatus =ServiceStatus.UNKNOWN
|
|
26
27
|
|
|
27
|
-
def check_service_status(self):
|
|
28
|
+
def check_service_status(self, session:requests.Session = None):
|
|
28
29
|
'''Checks the availability of the service.'''
|
|
30
|
+
s = session or requests
|
|
31
|
+
|
|
29
32
|
try:
|
|
30
|
-
r = head(self.url, timeout=2)
|
|
33
|
+
r = s.head(self.url, timeout=2)
|
|
31
34
|
if r.status_code < 400:
|
|
32
35
|
self.status = ServiceStatus.ACTIVE
|
|
33
36
|
else:
|
|
34
37
|
self.status = ServiceStatus.INACTIVE
|
|
35
|
-
except RequestException as e:
|
|
38
|
+
except requests.RequestException as e:
|
|
36
39
|
print(f"Request failed: {e}")
|
|
37
40
|
self.status = ServiceStatus.INACTIVE
|
|
38
41
|
|
|
@@ -42,12 +45,12 @@ class ServiceGroup(LabFREED_BaseModel):
|
|
|
42
45
|
origin: str = ""
|
|
43
46
|
services: list[Service] = Field(default_factory=list)
|
|
44
47
|
|
|
45
|
-
def update_states(self):
|
|
48
|
+
def update_states(self, session:requests.Session = None):
|
|
46
49
|
'''Triggers each service to check if the url can be reached'''
|
|
47
50
|
if not _has_internet_connection():
|
|
48
51
|
raise ConnectionError("No Internet Connection")
|
|
49
52
|
with ThreadPoolExecutor(max_workers=10) as executor:
|
|
50
|
-
futures = [executor.submit(s.check_service_status) for s in self.services]
|
|
53
|
+
futures = [executor.submit(s.check_service_status, session=session) for s in self.services]
|
|
51
54
|
for _ in as_completed(futures):
|
|
52
55
|
pass # just wait for all to finish
|
|
53
56
|
|
|
@@ -74,7 +77,7 @@ class ServiceGroup(LabFREED_BaseModel):
|
|
|
74
77
|
|
|
75
78
|
def _has_internet_connection():
|
|
76
79
|
try:
|
|
77
|
-
get("https://1.1.1.1", timeout=3)
|
|
80
|
+
requests.get("https://1.1.1.1", timeout=3)
|
|
78
81
|
return True
|
|
79
|
-
except RequestException:
|
|
82
|
+
except requests.RequestException:
|
|
80
83
|
return False
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/well_known_extensions/default_extension_interpreters.py
RENAMED
|
File without changes
|
{labfreed-0.2.7 → labfreed-0.2.8a0}/labfreed/well_known_extensions/display_name_extension.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|