labfreed 0.3.0a0__tar.gz → 0.3.0a1__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.3.0a0 → labfreed-0.3.0a1}/PKG-INFO +1 -1
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/__init__.py +1 -1
- {labfreed-0.3.0a0 → labfreed-0.3.0a1/labfreed}/labfreed_extended/pac_attributes/server/attribute_server_factory.py +36 -24
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/.github/workflows/pypi-publish.yml +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/.github/workflows/run-tests.yml +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/CHANGELOG.md +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/LICENSE +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/README.md +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1/labfreed}/labfreed_extended/app/app_infrastructure.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1/labfreed}/labfreed_extended/app/pac_info.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1/labfreed}/labfreed_extended/pac_attributes/py_attributes.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1/labfreed}/labfreed_extended/pac_attributes/server/excel_attribute_data_source.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1/labfreed}/labfreed_extended/utilities/formatted_print.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/labfreed_infrastructure.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_attributes/api_data_models/request.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_attributes/api_data_models/response.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_attributes/api_data_models/server_capabilities_response.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_attributes/client/__init__.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_attributes/client/attribute_cache.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_attributes/client/client.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_attributes/server/attribute_data_sources.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_attributes/server/server.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_attributes/server/translation_data_sources.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_attributes/well_knonw_attribute_keys.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_cat/__init__.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_cat/category_base.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_cat/pac_cat.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_cat/predefined_categories.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_id/__init__.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_id/extension.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_id/id_segment.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_id/pac_id.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_id/url_parser.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_id/url_serializer.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_id_resolver/__init__.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_id_resolver/cit_common.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_id_resolver/cit_v1.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_id_resolver/cit_v2.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_id_resolver/resolver.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_id_resolver/services.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/qr/__init__.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/qr/generate_qr.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/trex/__init__.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/trex/python_convenience/__init__.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/trex/python_convenience/data_table.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/trex/python_convenience/pyTREX.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/trex/python_convenience/quantity.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/trex/table_segment.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/trex/trex.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/trex/trex_base_models.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/trex/value_segments.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/utilities/base36.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/utilities/ensure_utc_time.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/utilities/translations.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/well_known_extensions/__init__.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/well_known_extensions/default_extension_interpreters.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/well_known_extensions/display_name_extension.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/well_known_extensions/trex_extension.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/well_known_keys/gs1/__init__.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/well_known_keys/gs1/gs1_ai_enum_sorted.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/well_known_keys/labfreed/well_known_keys.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/well_known_keys/unece/UneceUnits.json +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/well_known_keys/unece/__init__.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/well_known_keys/unece/unece_units.py +0 -0
- {labfreed-0.3.0a0 → labfreed-0.3.0a1}/pyproject.toml +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from enum import Enum
|
|
2
|
-
from typing import Any, Protocol
|
|
2
|
+
from typing import Any, Callable, Protocol
|
|
3
|
+
|
|
4
|
+
from flask import Blueprint
|
|
3
5
|
from labfreed.pac_attributes.server.server import AttributeGroupDataSource, AttributeServerRequestHandler, InvalidRequestError, TranslationDataSource
|
|
4
6
|
|
|
5
7
|
try:
|
|
@@ -55,30 +57,40 @@ class AttributeFlaskApp(Flask):
|
|
|
55
57
|
super().__init__(__name__, **kwargs)
|
|
56
58
|
self.config['ATTRIBUTE_REQUEST_HANDLER'] = request_handler
|
|
57
59
|
self.config['AUTHENTICATOR'] = authenticator
|
|
58
|
-
|
|
59
|
-
# add routes
|
|
60
|
-
self.add_url_rule('/', view_func=self.handle_attribute_request, methods=['POST'])
|
|
61
|
-
self.add_url_rule('/capabilities', view_func=request_handler.capabilities, methods=['GET'])
|
|
62
|
-
|
|
63
|
-
def handle_attribute_request(self):
|
|
64
|
-
authenticator = self.config['AUTHENTICATOR']
|
|
65
|
-
if not authenticator(request):
|
|
66
|
-
return Response(
|
|
67
|
-
'Unauthorized', 401,
|
|
68
|
-
{'WWW-Authenticate': 'Basic realm="Login required"'}
|
|
69
|
-
)
|
|
70
60
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
61
|
+
bp = self.create_attribute_blueprint(request_handler, authenticator)
|
|
62
|
+
self.register_blueprint(bp)
|
|
63
|
+
|
|
64
|
+
@staticmethod
|
|
65
|
+
def create_attribute_blueprint(
|
|
66
|
+
request_handler: AttributeServerRequestHandler,
|
|
67
|
+
authenticator: Authenticator | None = None
|
|
68
|
+
) -> Blueprint:
|
|
69
|
+
bp = Blueprint("attribute", __name__)
|
|
70
|
+
|
|
71
|
+
@bp.route("/", methods=["POST"])
|
|
72
|
+
def handle_attribute_request():
|
|
73
|
+
if authenticator and not authenticator(request):
|
|
74
|
+
return Response(
|
|
75
|
+
"Unauthorized", 401,
|
|
76
|
+
{"WWW-Authenticate": 'Basic realm="Login required"'}
|
|
77
|
+
)
|
|
78
|
+
try:
|
|
79
|
+
json_request_body = request.get_data(as_text=True)
|
|
80
|
+
response_body = request_handler.handle_attribute_request(json_request_body)
|
|
81
|
+
except InvalidRequestError as e:
|
|
82
|
+
print(e)
|
|
83
|
+
return "Invalid request", 400
|
|
84
|
+
except Exception as e:
|
|
85
|
+
print(e)
|
|
86
|
+
return "The request was valid, but the server encountered an error", 500
|
|
87
|
+
return response_body
|
|
88
|
+
|
|
89
|
+
@bp.route("/capabilities", methods=["GET"])
|
|
90
|
+
def capabilities():
|
|
91
|
+
return request_handler.capabilities()
|
|
92
|
+
|
|
93
|
+
return bp
|
|
82
94
|
|
|
83
95
|
|
|
84
96
|
|
|
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.3.0a0 → labfreed-0.3.0a1/labfreed}/labfreed_extended/pac_attributes/py_attributes.py
RENAMED
|
File without changes
|
|
File without changes
|
{labfreed-0.3.0a0 → labfreed-0.3.0a1/labfreed}/labfreed_extended/utilities/formatted_print.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
|
{labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_attributes/server/attribute_data_sources.py
RENAMED
|
File without changes
|
|
File without changes
|
{labfreed-0.3.0a0 → labfreed-0.3.0a1}/labfreed/pac_attributes/server/translation_data_sources.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
|
|
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.3.0a0 → labfreed-0.3.0a1}/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
|