nucliadb-sdk 6.6.1.post4601__py3-none-any.whl → 6.6.1.post4617__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.
nucliadb_sdk/v2/sdk.py CHANGED
@@ -640,7 +640,12 @@ def _request_sync_builder(
640
640
  path_template = sdk_def.path_template
641
641
  path_params = sdk_def.path_params
642
642
 
643
- def _func(self: NucliaDB, content: Optional[INPUT_TYPE] = None, **kwargs) -> OUTPUT_TYPE:
643
+ def _func(
644
+ self: NucliaDB,
645
+ content: Optional[INPUT_TYPE] = None,
646
+ headers: Optional[Dict[str, str]] = None,
647
+ **kwargs,
648
+ ) -> OUTPUT_TYPE:
644
649
  path, data, query_params = prepare_request(
645
650
  path_template=path_template,
646
651
  path_params=path_params,
@@ -648,7 +653,9 @@ def _request_sync_builder(
648
653
  content=content,
649
654
  **kwargs,
650
655
  )
651
- resp = self._request(path, method, content=data, query_params=query_params)
656
+ resp = self._request(
657
+ path, method, content=data, query_params=query_params, extra_headers=headers
658
+ )
652
659
  if response_type is not None:
653
660
  if issubclass(response_type, SyncAskResponse):
654
661
  return ask_response_parser(response_type, resp) # type: ignore
@@ -726,7 +733,12 @@ def _request_async_builder(
726
733
  path_template = sdk_def.path_template
727
734
  path_params = sdk_def.path_params
728
735
 
729
- async def _func(self: NucliaDBAsync, content: Optional[INPUT_TYPE] = None, **kwargs) -> OUTPUT_TYPE:
736
+ async def _func(
737
+ self: NucliaDBAsync,
738
+ content: Optional[INPUT_TYPE] = None,
739
+ headers: Optional[Dict[str, str]] = None,
740
+ **kwargs,
741
+ ) -> OUTPUT_TYPE:
730
742
  path, data, query_params = prepare_request(
731
743
  path_template=path_template,
732
744
  path_params=path_params,
@@ -734,7 +746,9 @@ def _request_async_builder(
734
746
  content=content,
735
747
  **kwargs,
736
748
  )
737
- resp = await self._request(path, method, content=data, query_params=query_params)
749
+ resp = await self._request(
750
+ path, method, content=data, query_params=query_params, extra_headers=headers
751
+ )
738
752
  if response_type is not None:
739
753
  if isinstance(response_type, type) and issubclass(response_type, SyncAskResponse):
740
754
  return ask_response_parser(response_type, resp) # type: ignore
@@ -841,6 +855,7 @@ class _NucliaDBBase:
841
855
  method: str,
842
856
  query_params: Optional[Dict[str, str]] = None,
843
857
  content: Optional[RawRequestContent] = None,
858
+ extra_headers: Optional[Dict[str, str]] = None,
844
859
  ):
845
860
  raise NotImplementedError
846
861
 
@@ -939,6 +954,7 @@ class NucliaDB(_NucliaDBBase):
939
954
  method: str,
940
955
  query_params: Optional[Dict[str, str]] = None,
941
956
  content: Optional[RawRequestContent] = None,
957
+ extra_headers: Optional[Dict[str, str]] = None,
942
958
  ):
943
959
  url = f"{self.base_url}{path}"
944
960
  opts: Dict[str, Any] = {}
@@ -948,6 +964,8 @@ class NucliaDB(_NucliaDBBase):
948
964
  opts["content"] = content
949
965
  if query_params is not None:
950
966
  opts["params"] = query_params
967
+ if extra_headers is not None:
968
+ opts["headers"] = extra_headers
951
969
  response: httpx.Response = getattr(self.session, method.lower())(url, **opts)
952
970
  return self._check_response(response)
953
971
 
@@ -1137,6 +1155,7 @@ class NucliaDBAsync(_NucliaDBBase):
1137
1155
  method: str,
1138
1156
  query_params: Optional[Dict[str, str]] = None,
1139
1157
  content: Optional[RawRequestContent] = None,
1158
+ extra_headers: Optional[Dict[str, str]] = None,
1140
1159
  ):
1141
1160
  url = f"{self.base_url}{path}"
1142
1161
  opts: Dict[str, Any] = {}
@@ -1146,6 +1165,8 @@ class NucliaDBAsync(_NucliaDBBase):
1146
1165
  opts["content"] = content
1147
1166
  if query_params is not None:
1148
1167
  opts["params"] = query_params
1168
+ if extra_headers is not None:
1169
+ opts["headers"] = extra_headers
1149
1170
  response: httpx.Response = await getattr(self.session, method.lower())(url, **opts)
1150
1171
  return self._check_response(response)
1151
1172
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb_sdk
3
- Version: 6.6.1.post4601
3
+ Version: 6.6.1.post4617
4
4
  Summary: NucliaDB SDK
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License-Expression: Apache-2.0
@@ -22,7 +22,7 @@ Requires-Dist: httpx
22
22
  Requires-Dist: orjson
23
23
  Requires-Dist: pydantic>=2.6
24
24
  Requires-Dist: nuclia-models>=0.43.0
25
- Requires-Dist: nucliadb-models>=6.6.1.post4601
25
+ Requires-Dist: nucliadb-models>=6.6.1.post4617
26
26
 
27
27
  # NucliaDB SDK
28
28
 
@@ -4,8 +4,8 @@ nucliadb_sdk/tests/__init__.py,sha256=74CI2MDrgAvfcsk1dRt543dUrqrfyWc6IFQdDdy2k_
4
4
  nucliadb_sdk/tests/fixtures.py,sha256=jeWHoLcJGOwX1-Dre-sqVFwwg5uWnR09ujLGPy7c3nQ,6731
5
5
  nucliadb_sdk/v2/__init__.py,sha256=XmxB8o1AUa3eWoxVHKMqXH88AESKM9IL8hFuI0KTR00,682
6
6
  nucliadb_sdk/v2/exceptions.py,sha256=fk4sEOUOgGpYe59DLxIkHflo4T6RcniwjY3VZGk4A70,1096
7
- nucliadb_sdk/v2/sdk.py,sha256=UWPVm9pHgkrEoycQasmM95VPDkUzugEZQ1DJNZiPIaw,48016
8
- nucliadb_sdk-6.6.1.post4601.dist-info/METADATA,sha256=5S486FJtLzw_lp08wc-lcEuT_xH2xM_Gs1pi1ttEP1U,6617
9
- nucliadb_sdk-6.6.1.post4601.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
- nucliadb_sdk-6.6.1.post4601.dist-info/top_level.txt,sha256=_dCwt_JnsZ3463lfvc5KcM2wUQJ9aSvKSsAAjGH8R0Y,13
11
- nucliadb_sdk-6.6.1.post4601.dist-info/RECORD,,
7
+ nucliadb_sdk/v2/sdk.py,sha256=0NZ6GsWLKIjjuFeRA07dYIOxfhRzRWdUaywEMRjPMx4,48600
8
+ nucliadb_sdk-6.6.1.post4617.dist-info/METADATA,sha256=tfck1NeBR4xPgmF8fLxDwID9kB0dMT-08wlyUqXem5Y,6617
9
+ nucliadb_sdk-6.6.1.post4617.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
+ nucliadb_sdk-6.6.1.post4617.dist-info/top_level.txt,sha256=_dCwt_JnsZ3463lfvc5KcM2wUQJ9aSvKSsAAjGH8R0Y,13
11
+ nucliadb_sdk-6.6.1.post4617.dist-info/RECORD,,