nucliadb 6.8.1.post4965__py3-none-any.whl → 6.8.1.post4979__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.

Potentially problematic release.


This version of nucliadb might be problematic. Click here for more details.

@@ -43,10 +43,8 @@ logger = logging.getLogger(SERVICE_NAME)
43
43
  WHITELISTED_HEADERS = {
44
44
  "x-nucliadb-user",
45
45
  "x-nucliadb-roles",
46
- "x-stf-roles",
47
- "x-stf-user",
48
- "x-stf-account",
49
- "x-stf-account-type",
46
+ "x-nucliadb-account",
47
+ "x-nucliadb-account-type",
50
48
  "x-forwarded-for",
51
49
  "x-forwarded-host",
52
50
  "x-forwarded-proto",
@@ -206,14 +204,14 @@ async def learning_config_proxy(
206
204
  request: Request,
207
205
  method: str,
208
206
  url: str,
209
- extra_headers: Optional[dict[str, str]] = None,
207
+ headers: dict[str, str] = {},
210
208
  ) -> Union[Response, StreamingResponse]:
211
209
  return await proxy(
212
210
  service=LearningService.CONFIG,
213
211
  request=request,
214
212
  method=method,
215
213
  url=url,
216
- extra_headers=extra_headers,
214
+ headers=headers,
217
215
  )
218
216
 
219
217
 
@@ -246,24 +244,21 @@ async def proxy(
246
244
  request: Request,
247
245
  method: str,
248
246
  url: str,
249
- extra_headers: Optional[dict[str, str]] = None,
247
+ headers: dict[str, str] = {},
250
248
  ) -> Union[Response, StreamingResponse]:
251
249
  """
252
250
  Proxy the request to a learning API.
253
251
 
254
- service: LearningService. The learning service to proxy the request to.
255
- request: Request. The incoming request.
256
- method: str. The HTTP method to use.
257
- url: str. The URL to proxy the request to.
258
- extra_headers: Optional[dict[str, str]]. Extra headers to include in the proxied request.
252
+ service: The learning service to proxy the request to.
253
+ request: The incoming request.
254
+ method: The HTTP method to use.
255
+ url: The URL to proxy the request to.
256
+ headers: Extra headers to include in the proxied request.
259
257
 
260
258
  Returns: Response. The response from the learning API. If the response is chunked, a StreamingResponse is returned.
261
259
  """
262
-
263
- proxied_headers = extra_headers or {}
264
- proxied_headers.update(
265
- {k.lower(): v for k, v in request.headers.items() if is_white_listed_header(k)}
266
- )
260
+ proxied_headers = {k.lower(): v for k, v in request.headers.items() if is_white_listed_header(k)}
261
+ proxied_headers.update(**headers)
267
262
 
268
263
  async with service_client(
269
264
  base_url=get_base_url(service=service),
@@ -25,6 +25,7 @@ from nuclia_models.config.proto import ExtractConfig, SplitConfiguration
25
25
 
26
26
  from nucliadb.learning_proxy import learning_config_proxy
27
27
  from nucliadb.models.responses import HTTPClientError
28
+ from nucliadb.reader import logger
28
29
  from nucliadb.reader.api.v1.router import KB_PREFIX, api
29
30
  from nucliadb_models.resource import NucliaDBRoles
30
31
  from nucliadb_utils.authentication import requires_one
@@ -68,7 +69,7 @@ async def get_configuration(
68
69
  request,
69
70
  "GET",
70
71
  f"/config/{kbid}",
71
- extra_headers={"X-STF-USER": request.headers.get("X-NUCLIADB-USER", "")},
72
+ headers={"account-id": request.headers.get("x-nucliadb-account", "")},
72
73
  )
73
74
 
74
75
 
@@ -108,7 +109,6 @@ async def get_model(
108
109
  request,
109
110
  "GET",
110
111
  f"/models/{kbid}/model/{model_id}",
111
- extra_headers={"X-STF-USER": request.headers.get("X-NUCLIADB-USER", "")},
112
112
  )
113
113
 
114
114
 
@@ -126,7 +126,17 @@ async def get_schema_for_configuration_updates(
126
126
  request: Request,
127
127
  kbid: str,
128
128
  ):
129
- return await learning_config_proxy(request, "GET", f"/schema/{kbid}")
129
+ account_id = request.headers.get("x-nucliadb-account", "")
130
+ if not account_id:
131
+ logger.warning(
132
+ "Account header not sent by authorizer", extra={"request_headers": request.headers}
133
+ )
134
+ return await learning_config_proxy(
135
+ request,
136
+ "GET",
137
+ f"/schema/{kbid}",
138
+ headers={"account-id": account_id},
139
+ )
130
140
 
131
141
 
132
142
  @api.get(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb
3
- Version: 6.8.1.post4965
3
+ Version: 6.8.1.post4979
4
4
  Summary: NucliaDB
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -19,11 +19,11 @@ Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3 :: Only
20
20
  Requires-Python: <4,>=3.9
21
21
  Description-Content-Type: text/markdown
22
- Requires-Dist: nucliadb-telemetry[all]>=6.8.1.post4965
23
- Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.8.1.post4965
24
- Requires-Dist: nucliadb-protos>=6.8.1.post4965
25
- Requires-Dist: nucliadb-models>=6.8.1.post4965
26
- Requires-Dist: nidx-protos>=6.8.1.post4965
22
+ Requires-Dist: nucliadb-telemetry[all]>=6.8.1.post4979
23
+ Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.8.1.post4979
24
+ Requires-Dist: nucliadb-protos>=6.8.1.post4979
25
+ Requires-Dist: nucliadb-models>=6.8.1.post4979
26
+ Requires-Dist: nidx-protos>=6.8.1.post4979
27
27
  Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
28
28
  Requires-Dist: nuclia-models>=0.47.0
29
29
  Requires-Dist: uvicorn[standard]
@@ -47,7 +47,7 @@ migrations/pg/0009_extract_facets_safety.py,sha256=k9Appx7ipp3wDyLy70qgw9oLjN7N6
47
47
  migrations/pg/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
48
48
  nucliadb/__init__.py,sha256=_abCmDJ_0ku483Os4UAjPX7Nywm39cQgAV_DiyjsKeQ,891
49
49
  nucliadb/health.py,sha256=UIxxA4oms4HIsCRZM_SZsdkIZIlgzmOxw-qSHLlWuak,3465
50
- nucliadb/learning_proxy.py,sha256=CGwKlKHMDYMMRj5-8M4nNvsV3O88A2mLRr0kfjSZTBA,19341
50
+ nucliadb/learning_proxy.py,sha256=2ucru4pHfFYWdjt875YKeGBjx1sZ7lGvS5Xnp6l2ZNs,19173
51
51
  nucliadb/metrics_exporter.py,sha256=CdfDqKqR-4xMjZxITl6F6mV539iXVsF5ovXCPHjKp40,5341
52
52
  nucliadb/openapi.py,sha256=dI5hHSUs2oHf4fd27gGagVltWfjVZPIoVqMtIN04VJk,2290
53
53
  nucliadb/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -206,7 +206,7 @@ nucliadb/reader/api/v1/__init__.py,sha256=ieP8lsCCwG66Jupv8II5MSTj6nh3eCtLcF4utH
206
206
  nucliadb/reader/api/v1/download.py,sha256=F48YM3BPwuHwDgYk0jjRHHJHh732QUb4nCAS5xyNqzg,10819
207
207
  nucliadb/reader/api/v1/export_import.py,sha256=x4VBNDFjnlY1nIt5kdq0eZTB_DeRzGzT8T7uB7wUhNU,6448
208
208
  nucliadb/reader/api/v1/knowledgebox.py,sha256=e8q7v5JwGxsuPZLc_GkUOkWWSJMI2o483bK9ywhdkk8,3612
209
- nucliadb/reader/api/v1/learning_config.py,sha256=fNnv-7CuhTu_p6aDkuMLRP5-R5Try-_prKhh8Woq1Pw,6830
209
+ nucliadb/reader/api/v1/learning_config.py,sha256=SItQbdISCuJS0i0RHU6vAwXpHEelxrf_cZK5yQak4PE,7071
210
210
  nucliadb/reader/api/v1/resource.py,sha256=WTBIEywfHfy4sIffnVm9s__3--JpHi9hprVpK0Ddd04,14164
211
211
  nucliadb/reader/api/v1/router.py,sha256=eyNmEGSP9zHkCIG5XlAXl6sukq950B7gFT3X2peMtIE,1011
212
212
  nucliadb/reader/api/v1/services.py,sha256=Fcj4fRDBNnIwnf5Q3VZxpP_6UwdPYOtyEZUGr9_lhqo,13438
@@ -379,8 +379,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
379
379
  nucliadb/writer/tus/s3.py,sha256=vu1BGg4VqJ_x2P1u2BxqPKlSfw5orT_a3R-Ln5oPUpU,8483
380
380
  nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
381
381
  nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
382
- nucliadb-6.8.1.post4965.dist-info/METADATA,sha256=QFrP-BjOYg7Bc7zaHPxkBCFi2f9ybaHcJ2O67hkylqY,4158
383
- nucliadb-6.8.1.post4965.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
384
- nucliadb-6.8.1.post4965.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
385
- nucliadb-6.8.1.post4965.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
386
- nucliadb-6.8.1.post4965.dist-info/RECORD,,
382
+ nucliadb-6.8.1.post4979.dist-info/METADATA,sha256=Bp9I_V8pCDvtLHcCCtORjqkA_EQLt7Cy51GIFWI4LrY,4158
383
+ nucliadb-6.8.1.post4979.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
384
+ nucliadb-6.8.1.post4979.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
385
+ nucliadb-6.8.1.post4979.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
386
+ nucliadb-6.8.1.post4979.dist-info/RECORD,,