labfreed 1.0.0a8__py3-none-any.whl → 1.0.0a10__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.
- labfreed/__init__.py +1 -1
- labfreed/pac_attributes/api_data_models/request.py +1 -1
- labfreed/pac_attributes/client/client.py +1 -1
- labfreed/pac_attributes/pythonic/attribute_server_factory.py +34 -27
- {labfreed-1.0.0a8.dist-info → labfreed-1.0.0a10.dist-info}/METADATA +1 -1
- {labfreed-1.0.0a8.dist-info → labfreed-1.0.0a10.dist-info}/RECORD +8 -8
- {labfreed-1.0.0a8.dist-info → labfreed-1.0.0a10.dist-info}/WHEEL +0 -0
- {labfreed-1.0.0a8.dist-info → labfreed-1.0.0a10.dist-info}/licenses/LICENSE +0 -0
labfreed/__init__.py
CHANGED
|
@@ -8,7 +8,7 @@ class AttributeRequestPayload(LabFREED_BaseModel):
|
|
|
8
8
|
model_config = ConfigDict(frozen=True)
|
|
9
9
|
|
|
10
10
|
pac_ids: list[str]
|
|
11
|
-
language_preferences: list[str]
|
|
11
|
+
language_preferences: list[str]|None = None
|
|
12
12
|
restrict_to_attribute_groups: list[str]|None = None
|
|
13
13
|
suppress_forward_lookup: bool = False
|
|
14
14
|
|
|
@@ -142,7 +142,7 @@ class AttributeClient():
|
|
|
142
142
|
r = AttributeResponsePayload.model_validate_json(response_body_str)
|
|
143
143
|
except ValidationError as e:
|
|
144
144
|
print(e)
|
|
145
|
-
raise AttributeServerError("The server accepted the request, and sent a reponse. However, the response is adhering to the PAC Attributes specifications. Contact the server admin.")
|
|
145
|
+
raise AttributeServerError("The server accepted the request, and sent a reponse. However, the response is not adhering to the PAC Attributes specifications. Contact the server admin.")
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
# update cache
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from enum import Enum
|
|
2
2
|
from typing import Any, Protocol
|
|
3
3
|
|
|
4
|
-
from flask import Blueprint, current_app
|
|
4
|
+
from flask import Blueprint, current_app, url_for
|
|
5
5
|
from labfreed.pac_attributes.api_data_models.request import AttributeRequestPayload
|
|
6
6
|
from labfreed.pac_attributes.server.server import AttributeGroupDataSource, AttributeServerRequestHandler, InvalidRequestError, TranslationDataSource
|
|
7
7
|
|
|
@@ -87,40 +87,47 @@ class AttributeFlaskApp(Flask):
|
|
|
87
87
|
except Exception as e:
|
|
88
88
|
print(e)
|
|
89
89
|
return "The request was valid, but the server encountered an error", 500
|
|
90
|
-
return response_body
|
|
90
|
+
return (response_body, 200, {"Content-Type": "application/json"})
|
|
91
91
|
|
|
92
92
|
@bp.route("/", methods=["GET"], strict_slashes=False)
|
|
93
93
|
def capabilities():
|
|
94
94
|
doc_text = current_app.config.get('DOC_TEXT', "")
|
|
95
95
|
capabilities = request_handler.capabilities()
|
|
96
|
-
authentication_required = bool(current_app.config
|
|
96
|
+
authentication_required = bool(current_app.config.get('AUTHENTICATOR'))
|
|
97
97
|
example_request = AttributeRequestPayload(pac_ids=['HTTPS://PAC.METTORIUS.COM/EXAMPLE'], language_preferences=['fr', 'de']).model_dump_json(indent=2, exclude_none=True, exclude_unset=True)
|
|
98
98
|
server_address = request.url.rstrip('/')
|
|
99
|
+
css_url = url_for("static", filename="style.css")
|
|
99
100
|
response = f'''
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
101
|
+
<html>
|
|
102
|
+
<head>
|
|
103
|
+
<link rel="stylesheet" type="text/css" href="{css_url}">
|
|
104
|
+
</head>
|
|
105
|
+
|
|
106
|
+
<body>
|
|
107
|
+
This is a <h1>LabFREED attribute server </h1>
|
|
108
|
+
<h2>Capabilities</h2>
|
|
109
|
+
Available Attribute Groups: {', '.join([f'<a href="{ag}"> {ag} </a>' for ag in capabilities.available_attribute_groups])} <br>
|
|
110
|
+
|
|
111
|
+
Supported Languages: {', '.join([f'<b> {l} </b>' for l in capabilities.supported_languages])} <br>
|
|
112
|
+
Default Language: <b>{capabilities.default_language}</b> <br>
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
<h2>How to use</h2>
|
|
116
|
+
Make a <b>POST</b> request to <a href="{server_address}">{server_address}</a> with the following body:
|
|
117
|
+
<pre>{example_request}</pre>
|
|
118
|
+
Consult <a href="https://github.com/ApiniLabs/PAC-Attributes"> the specification </a> for details. <br>
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
{'This server <b> requires authentication </b> ' if authentication_required else ''}
|
|
122
|
+
<br>
|
|
123
|
+
|
|
124
|
+
{"<h2>Further Information</h2>"if doc_text else ""}
|
|
125
|
+
{doc_text or ""}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
</body>
|
|
129
|
+
</html>
|
|
130
|
+
'''
|
|
124
131
|
|
|
125
132
|
return response
|
|
126
133
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
labfreed/__init__.py,sha256=
|
|
1
|
+
labfreed/__init__.py,sha256=9Qb9__7-dzdAgF1CQpw55HFhPjHJUclR9ynTV7qo-1I,339
|
|
2
2
|
labfreed/labfreed_infrastructure.py,sha256=YZmU-kgopyB1tvpTR_k_uIt1Q2ezexMrWvu-HaP65IE,10104
|
|
3
3
|
labfreed/labfreed_extended/app/app_infrastructure.py,sha256=F5UHHt8-r7jigQudOsJ-yV4lWKHFsxNhI4uGP_h53lE,4035
|
|
4
4
|
labfreed/labfreed_extended/app/formatted_print.py,sha256=DcwWP0ix1e_wYNIdceIp6cETkJdG2DqpU8Gs3aZAL40,1930
|
|
@@ -10,13 +10,13 @@ labfreed/labfreed_extended/app/pac_info/html_renderer/pac_info.jinja.html,sha256
|
|
|
10
10
|
labfreed/labfreed_extended/app/pac_info/html_renderer/pac_info_card.jinja.html,sha256=6UdsZtqJ3soSAYTKN43OB1Onm93WYz23TfM2GBYzJ-U,152
|
|
11
11
|
labfreed/pac_attributes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
labfreed/pac_attributes/well_knonw_attribute_keys.py,sha256=axE81MeJ3G_Wy1PbmNAXH6SfPtl96NXvQJMyrvK10t4,324
|
|
13
|
-
labfreed/pac_attributes/api_data_models/request.py,sha256
|
|
13
|
+
labfreed/pac_attributes/api_data_models/request.py,sha256=N-kXlJWYqh-F1TzNunCwHUPhme3bSLJMgb9aAHWGOy4,1880
|
|
14
14
|
labfreed/pac_attributes/api_data_models/response.py,sha256=eGh474ILEcBC1ijhs1ZZfdhNWRxiPeccGS8aw0zzt0U,6934
|
|
15
15
|
labfreed/pac_attributes/api_data_models/server_capabilities_response.py,sha256=ypDm4f8xZZl036fp8PuIe6lJHNW5Zg1fItgUlnV75V0,178
|
|
16
16
|
labfreed/pac_attributes/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
labfreed/pac_attributes/client/attribute_cache.py,sha256=ThUadWqQ5oM8DnAnvZuY4jeA3Mg06ePNEcRP5wCsadc,2222
|
|
18
|
-
labfreed/pac_attributes/client/client.py,sha256=
|
|
19
|
-
labfreed/pac_attributes/pythonic/attribute_server_factory.py,sha256=
|
|
18
|
+
labfreed/pac_attributes/client/client.py,sha256=FjvyEpZEGYrZkuaQoqH9QFstrwHmrsIdaymxz8uQjwQ,7510
|
|
19
|
+
labfreed/pac_attributes/pythonic/attribute_server_factory.py,sha256=HnKxrNdIXVP-kSLvf2p-X4AMjaIKi6XfUD2fLXSqAHo,6190
|
|
20
20
|
labfreed/pac_attributes/pythonic/excel_attribute_data_source.py,sha256=oP4OHj0DTlH4dD7OlL1qxtX4y9KcuDTCd9Bi_FruP6A,7276
|
|
21
21
|
labfreed/pac_attributes/pythonic/py_attributes.py,sha256=FXSp9_P0o-GuZSDvXtD2fU4g82lglMu9f_-8KPMkEP0,6821
|
|
22
22
|
labfreed/pac_attributes/pythonic/py_dict_data_source.py,sha256=nAz6GA7Xx_0IORPPpt_Wl3sFJa1Q5Fnq5vdf1uQiJF8,531
|
|
@@ -64,7 +64,7 @@ labfreed/well_known_keys/labfreed/well_known_keys.py,sha256=p-hXwEEIs7p2SKn9DQeL
|
|
|
64
64
|
labfreed/well_known_keys/unece/UneceUnits.json,sha256=kwfQSp_nTuWbADfBBgqTWrvPl6XtM5SedEVLbMJrM7M,898953
|
|
65
65
|
labfreed/well_known_keys/unece/__init__.py,sha256=MSP9lmjg9_D9iqG9Yq2_ajYfQSNS9wIT7FXA1c--59M,122
|
|
66
66
|
labfreed/well_known_keys/unece/unece_units.py,sha256=J20d64H69qKDE3XlGdJoXIIh0G-d0jKoiIDsg9an5pk,1655
|
|
67
|
-
labfreed-1.0.
|
|
68
|
-
labfreed-1.0.
|
|
69
|
-
labfreed-1.0.
|
|
70
|
-
labfreed-1.0.
|
|
67
|
+
labfreed-1.0.0a10.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
|
|
68
|
+
labfreed-1.0.0a10.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
69
|
+
labfreed-1.0.0a10.dist-info/METADATA,sha256=ut_Cchg7aHQ8hJfQZdSQAsio4HMBSMt8MjiGHrFlRaI,19741
|
|
70
|
+
labfreed-1.0.0a10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|