labfreed 1.0.0a9__py3-none-any.whl → 1.0.0a11__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 CHANGED
@@ -2,7 +2,7 @@
2
2
  Python implementation of LabFREED building blocks
3
3
  '''
4
4
 
5
- __version__ = "1.0.0a9"
5
+ __version__ = "1.0.0a11"
6
6
 
7
7
  from labfreed.pac_id import * # noqa: F403
8
8
  from labfreed.pac_cat import * # noqa: F403
@@ -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,7 +87,7 @@ 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():
@@ -96,31 +96,38 @@ class AttributeFlaskApp(Flask):
96
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
- <body>
101
- This is a <h1>LabFREED attribute server </h1>
102
- <h2>Capabilities</h2>
103
- Available Attribute Groups: {', '.join([f'<a href="{ag}"> {ag} </a>' for ag in capabilities.available_attribute_groups])} <br>
104
-
105
- Supported Languages: {', '.join([f'<b> {l} </b>' for l in capabilities.supported_languages])} <br>
106
- Default Language: <b>{capabilities.default_language}</b> <br>
107
-
108
-
109
- <h2>How to use</h2>
110
- Make a <b>POST</b> request to <a href="{server_address}">{server_address}</a> with the following body:
111
- <pre>{example_request}</pre>
112
- Consult <a href="https://github.com/ApiniLabs/PAC-Attributes"> the specification </a> for details. <br>
113
-
114
-
115
- {'This server <b> requires authentication </b> ' if authentication_required else ''}
116
- <br>
117
-
118
- {"<h2>Further Information</h2>"if doc_text else ""}
119
- {doc_text or ""}
120
-
121
-
122
- </body>
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 <br> {''.join([f'<a href="{ag}"> {ag} </a><br>' for ag in capabilities.available_attribute_groups])} <br>
110
+
111
+ Supported Languages: {', '.join([f'<b> {l} </b>' for l in capabilities.supported_languages])} <br><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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labfreed
3
- Version: 1.0.0a9
3
+ Version: 1.0.0a11
4
4
  Summary: Python implementation of LabFREED building blocks
5
5
  Author-email: Reto Thürer <thuerer.r@buchi.com>
6
6
  Requires-Python: >=3.11
@@ -1,4 +1,4 @@
1
- labfreed/__init__.py,sha256=wQI1Zn83JUEA_A8Tdaf1P78-Pa_Lg_T5uxCPmj46wN8,338
1
+ labfreed/__init__.py,sha256=Av3vixNTNkUV8H8oi-fZ3iwAwsFx6NvLgisFqsGX5NA,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=-CI3rU_Bzw2DZGSS06Jl4zajrxMkfPGhKHWmIfnmWlk,1868
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=DcD9wG3Zc7Iznr5Wlrwp17QgE2tjPxITgmjmSQonvAo,7506
19
- labfreed/pac_attributes/pythonic/attribute_server_factory.py,sha256=DatCagOpbuURssP5M6sjvhPK-yilq8xSjuHTGaKCVJ0,5739
18
+ labfreed/pac_attributes/client/client.py,sha256=FjvyEpZEGYrZkuaQoqH9QFstrwHmrsIdaymxz8uQjwQ,7510
19
+ labfreed/pac_attributes/pythonic/attribute_server_factory.py,sha256=AtoOICmAGQY_ZkCcnPW4t8kv3LHaro-a-Ylm04j-Dbc,6199
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.0a9.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
68
- labfreed-1.0.0a9.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
69
- labfreed-1.0.0a9.dist-info/METADATA,sha256=QdAoKgVWGUOJHTaWiyq4FExbgpzuIqY3jTFNjcyuXus,19740
70
- labfreed-1.0.0a9.dist-info/RECORD,,
67
+ labfreed-1.0.0a11.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
68
+ labfreed-1.0.0a11.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
69
+ labfreed-1.0.0a11.dist-info/METADATA,sha256=TsJ8XB7L3jnqS6RmX9GCactdXC8K81axahxQns-bvqs,19741
70
+ labfreed-1.0.0a11.dist-info/RECORD,,