labfreed 1.0.0b29__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 +1 -1
- labfreed/pac_attributes/pythonic/attribute_server_factory.py +23 -1
- {labfreed-1.0.0b29.dist-info → labfreed-1.0.0b30.dist-info}/METADATA +1 -1
- {labfreed-1.0.0b29.dist-info → labfreed-1.0.0b30.dist-info}/RECORD +6 -6
- {labfreed-1.0.0b29.dist-info → labfreed-1.0.0b30.dist-info}/WHEEL +0 -0
- {labfreed-1.0.0b29.dist-info → labfreed-1.0.0b30.dist-info}/licenses/LICENSE +0 -0
labfreed/__init__.py
CHANGED
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
labfreed/__init__.py,sha256=
|
|
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
|
|
@@ -41,7 +41,7 @@ labfreed/pac_attributes/api_data_models/response.py,sha256=8OhqMrZJSzQlSTG9bES7b
|
|
|
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=
|
|
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.
|
|
94
|
-
labfreed-1.0.
|
|
95
|
-
labfreed-1.0.
|
|
96
|
-
labfreed-1.0.
|
|
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,,
|
|
File without changes
|
|
File without changes
|