labfreed 1.0.0b28__py3-none-any.whl → 1.0.0b30__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.0b28"
5
+ __version__ = "1.0.0b30"
6
6
 
7
7
  from labfreed.pac_id import * # noqa: F403
8
8
  from labfreed.pac_cat import * # noqa: F403
@@ -1,6 +1,6 @@
1
1
 
2
2
  from abc import ABC
3
- from datetime import datetime
3
+ from datetime import datetime, date
4
4
  import re
5
5
  from typing import Annotated, Any, Literal, Union, get_args
6
6
  from urllib.parse import urlparse
@@ -43,7 +43,7 @@ class AttributeItemsElementBase(LabFREED_BaseModel, ABC):
43
43
 
44
44
  class DateTimeAttributeItemsElement(AttributeItemsElementBase):
45
45
  type: Literal["datetime"] = "datetime"
46
- value: datetime
46
+ value: date | datetime
47
47
 
48
48
  @field_validator('value', mode='after')
49
49
  def set_utc__if_naive(cls, value):
@@ -1,10 +1,11 @@
1
1
  from enum import Enum
2
+ from functools import wraps
2
3
  import json
3
4
  import logging
4
5
  from typing import Any, Protocol
5
6
  from urllib.parse import unquote, unquote_plus
6
7
 
7
- from flask import Blueprint, current_app, redirect, url_for, send_from_directory
8
+ from flask import Blueprint, current_app, make_response, redirect, url_for, send_from_directory
8
9
  from labfreed.pac_attributes.api_data_models.request import AttributeRequestData
9
10
  from labfreed.pac_attributes.server.server import AttributeGroupDataSource, AttributeServerRequestHandler, InvalidRequestError, TranslationDataSource
10
11
 
@@ -75,6 +76,7 @@ class AttributeFlaskApp(Flask):
75
76
 
76
77
 
77
78
  @bp.get("/<path:pac_id_url_encoded>", strict_slashes=False)
79
+ @cors_attributes
78
80
  def handle_attribute_request(pac_id_url_encoded):
79
81
 
80
82
  if authenticator and not authenticator(request):
@@ -161,6 +163,26 @@ class AttributeFlaskApp(Flask):
161
163
  return bp
162
164
 
163
165
 
166
+ def cors_attributes(fn):
167
+ @wraps(fn)
168
+ def wrapper(*args, **kwargs):
169
+ # Preflight
170
+ if request.method == "OPTIONS":
171
+ response = make_response()
172
+ response.headers["Access-Control-Allow-Origin"] = "*"
173
+ response.headers["Access-Control-Allow-Methods"] = "GET, OPTIONS"
174
+ response.headers["Access-Control-Allow-Headers"] = "Content-Type, Authorization"
175
+ response.headers["Access-Control-Max-Age"] = "86400"
176
+ return response
177
+
178
+ # Actual request
179
+ response = make_response(fn(*args, **kwargs))
180
+ response.headers["Access-Control-Allow-Origin"] = "*"
181
+ return response
182
+
183
+ return wrapper
184
+
185
+
164
186
 
165
187
 
166
188
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labfreed
3
- Version: 1.0.0b28
3
+ Version: 1.0.0b30
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=6dNDBc-c9yS4FwmyZWmNsoq8OyAU4tz3HR2lTYcrhQs,339
1
+ labfreed/__init__.py,sha256=Qnyz1GvOjSxXMTpBsZtUIJNGgi9Qltpz92tfgfMoLEQ,339
2
2
  labfreed/labfreed_infrastructure.py,sha256=ss1PyJl-7Es-lEcxptmdYI9kDAHmh7HB_tAGkPC6UVs,10173
3
3
  labfreed/labfreed_extended/app/app_infrastructure.py,sha256=1867Nq40c8Q4bFyRv48vTIFDXoPeZTfYij9PSog6fkE,4427
4
4
  labfreed/labfreed_extended/app/formatted_print.py,sha256=DcwWP0ix1e_wYNIdceIp6cETkJdG2DqpU8Gs3aZAL40,1930
@@ -37,11 +37,11 @@ labfreed/labfreed_extended/pac_issuer_lib/templates/pac_info/pac_info.jinja.html
37
37
  labfreed/pac_attributes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  labfreed/pac_attributes/well_knonw_attribute_keys.py,sha256=Z_QcQdbIil_EMpFqQcBnivEGMDauyoCMW8r62-EN2KM,547
39
39
  labfreed/pac_attributes/api_data_models/request.py,sha256=DhCGuwfRypq5fitZKS9Bvj8AFfCKaakKc-m6IMKj-3s,4410
40
- labfreed/pac_attributes/api_data_models/response.py,sha256=Hglfcvb7gC7uZrLsGfPewC290vp4qq4WsuM9S3UHQFI,8188
40
+ labfreed/pac_attributes/api_data_models/response.py,sha256=8OhqMrZJSzQlSTG9bES7bNdZuDtaB6CTiYSSuLD6xrE,8201
41
41
  labfreed/pac_attributes/api_data_models/server_capabilities_response.py,sha256=ypDm4f8xZZl036fp8PuIe6lJHNW5Zg1fItgUlnV75V0,178
42
42
  labfreed/pac_attributes/client/client.py,sha256=5d-G-1tHOx2PXW7KP366tWr4k4F1ykGHX9e-bauF6_w,7149
43
43
  labfreed/pac_attributes/client/client_attribute_group.py,sha256=lZXbMU_Yp7Q1iKc5WRqS6pzEz_mtwZaQ5fYZqJA6784,375
44
- labfreed/pac_attributes/pythonic/attribute_server_factory.py,sha256=VYyVfhTpNQlLtpMBGWcpnoQHIqehr3K44rdUT9dQepE,7774
44
+ labfreed/pac_attributes/pythonic/attribute_server_factory.py,sha256=KDhe_AXM7ZyEAaFda0EWOlGF6P52p2eL2vaR1zZ2PGg,8563
45
45
  labfreed/pac_attributes/pythonic/excel_attribute_data_source.py,sha256=IBBGpHgt-HiZeB6dsLcjtqUPP2JdViLz2QMIDMjzmME,8467
46
46
  labfreed/pac_attributes/pythonic/py_attributes.py,sha256=9ATeMia7PXZjRrpDouC5siDZ-dbDa6EPhyl7xCEDIG8,7552
47
47
  labfreed/pac_attributes/pythonic/py_dict_data_source.py,sha256=nAz6GA7Xx_0IORPPpt_Wl3sFJa1Q5Fnq5vdf1uQiJF8,531
@@ -90,7 +90,7 @@ labfreed/well_known_keys/labfreed/well_known_keys.py,sha256=p-hXwEEIs7p2SKn9DQeL
90
90
  labfreed/well_known_keys/unece/UneceUnits.json,sha256=kwfQSp_nTuWbADfBBgqTWrvPl6XtM5SedEVLbMJrM7M,898953
91
91
  labfreed/well_known_keys/unece/__init__.py,sha256=MSP9lmjg9_D9iqG9Yq2_ajYfQSNS9wIT7FXA1c--59M,122
92
92
  labfreed/well_known_keys/unece/unece_units.py,sha256=J20d64H69qKDE3XlGdJoXIIh0G-d0jKoiIDsg9an5pk,1655
93
- labfreed-1.0.0b28.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
94
- labfreed-1.0.0b28.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
95
- labfreed-1.0.0b28.dist-info/METADATA,sha256=xn7Zie9NrWA3Zd1E__IiOsd8-mdnwy2u_IlUbAeTbaE,19858
96
- labfreed-1.0.0b28.dist-info/RECORD,,
93
+ labfreed-1.0.0b30.dist-info/licenses/LICENSE,sha256=gHFOv9FRKHxO8cInP3YXyPoJnuNeqrvcHjaE_wPSsQ8,1100
94
+ labfreed-1.0.0b30.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
95
+ labfreed-1.0.0b30.dist-info/METADATA,sha256=09ar0WBTwVLwRIMUrgTuS6QAWlDAT40QnA9u0t6mkZQ,19858
96
+ labfreed-1.0.0b30.dist-info/RECORD,,