nucliadb-sdk 6.3.5.post3980__py3-none-any.whl → 6.3.5.post3990__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.
@@ -28,8 +28,8 @@ from typing import Optional
28
28
  from uuid import uuid4
29
29
 
30
30
  import docker # type: ignore
31
+ import httpx
31
32
  import pytest
32
- import requests
33
33
  from pytest_docker_fixtures import images # type: ignore
34
34
  from pytest_docker_fixtures.containers._base import BaseImage # type: ignore
35
35
 
@@ -71,7 +71,7 @@ class NucliaDB(BaseImage):
71
71
 
72
72
  def check(self):
73
73
  try:
74
- response = requests.get(f"http://{self.host}:{self.get_port()}")
74
+ response = httpx.get(f"http://{self.host}:{self.get_port()}")
75
75
  return response.status_code == 200
76
76
  except Exception:
77
77
  return False
@@ -132,13 +132,13 @@ def nucliadb(pg):
132
132
  # Wait for service ready
133
133
  for _ in range(10):
134
134
  try:
135
- if requests.get(f"http://localhost:8080").status_code == 200:
135
+ if httpx.get(f"http://localhost:8080").status_code == 200:
136
136
  break
137
137
  except Exception:
138
138
  pass
139
139
  time.sleep(1)
140
140
 
141
- if requests.get(f"http://localhost:8080").status_code != 200:
141
+ if httpx.get(f"http://localhost:8080").status_code != 200:
142
142
  raise Exception("No NucliaDB Running")
143
143
 
144
144
  yield NucliaFixture(
@@ -204,7 +204,7 @@ async def init_fixture(
204
204
  kb_obj = sdk.create_knowledge_box(slug=slug)
205
205
  kbid = kb_obj.uuid
206
206
 
207
- import_resp = requests.get(dataset_location)
207
+ import_resp = httpx.get(dataset_location)
208
208
  assert import_resp.status_code == 200, (
209
209
  f"Error pulling dataset {dataset_location}:{import_resp.status_code}"
210
210
  )
nucliadb_sdk/v2/sdk.py CHANGED
@@ -19,6 +19,7 @@
19
19
  from __future__ import annotations
20
20
 
21
21
  import enum
22
+ import importlib.metadata
22
23
  import inspect
23
24
  import io
24
25
  import warnings
@@ -119,6 +120,7 @@ OUTPUT_TYPE = TypeVar("OUTPUT_TYPE", bound=Union[BaseModel, None])
119
120
  RawRequestContent = Union[str, bytes, Iterable[bytes], AsyncIterable[bytes], dict[str, Any]]
120
121
 
121
122
  INPUT_TYPE = TypeVar("INPUT_TYPE", BaseModel, List[InputMessage], RawRequestContent, object, None)
123
+ USER_AGENT = f"nucliadb-sdk/{importlib.metadata.version('nucliadb_sdk')}"
122
124
 
123
125
 
124
126
  class Region(enum.Enum):
@@ -821,7 +823,7 @@ class _NucliaDBBase:
821
823
  if api_key is not None:
822
824
  headers["X-STF-SERVICEACCOUNT"] = f"Bearer {api_key}"
823
825
 
824
- self.headers = headers
826
+ self.headers = {"User-Agent": USER_AGENT, **headers}
825
827
 
826
828
  def _request(
827
829
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb_sdk
3
- Version: 6.3.5.post3980
3
+ Version: 6.3.5.post3990
4
4
  Summary: NucliaDB SDK
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License: AGPL
@@ -20,11 +20,10 @@ Classifier: Programming Language :: Python :: 3 :: Only
20
20
  Requires-Python: <4,>=3.9
21
21
  Description-Content-Type: text/markdown
22
22
  Requires-Dist: httpx
23
- Requires-Dist: requests
24
23
  Requires-Dist: orjson
25
24
  Requires-Dist: pydantic>=2.6
26
25
  Requires-Dist: nuclia-models>=0.24.2
27
- Requires-Dist: nucliadb-models>=6.3.5.post3980
26
+ Requires-Dist: nucliadb-models>=6.3.5.post3990
28
27
 
29
28
  # NucliaDB SDK
30
29
 
@@ -1,11 +1,11 @@
1
1
  nucliadb_sdk/__init__.py,sha256=CkjYIXKAJkX7qnZiN-sYtvIDp0h4IEazc8HhvMuZiYc,990
2
2
  nucliadb_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  nucliadb_sdk/tests/__init__.py,sha256=itSI7dtTwFP55YMX4iK7JzdMHS5CQVUiB1XzQu4UBh8,833
4
- nucliadb_sdk/tests/fixtures.py,sha256=Skx6UzLnxeTC17zE3HzEKWTHpYBsr_Pm2UyqDaxj23E,7052
4
+ nucliadb_sdk/tests/fixtures.py,sha256=HrqlUoVHnF1PGn0MrXrBeT_Fjv8kUuNa9SINUXamPq4,7037
5
5
  nucliadb_sdk/v2/__init__.py,sha256=F9kJzOkphCL6fIGXBkQbXAAYS2ZzkOLzA4Nudwf1310,934
6
6
  nucliadb_sdk/v2/exceptions.py,sha256=cof-xdkqjWn1aGx1ul6Q4ydX97DbLie-LfwfX_PlhAQ,1348
7
- nucliadb_sdk/v2/sdk.py,sha256=5W_jBrEW6PUkHQyb-LUFBJn0LV4WvC_QGVeLdhSP6fM,46938
8
- nucliadb_sdk-6.3.5.post3980.dist-info/METADATA,sha256=_9Oa2Wmo5CVYeR1pClgSRUdivKHcew522UiKkP2x_aA,6719
9
- nucliadb_sdk-6.3.5.post3980.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
10
- nucliadb_sdk-6.3.5.post3980.dist-info/top_level.txt,sha256=_dCwt_JnsZ3463lfvc5KcM2wUQJ9aSvKSsAAjGH8R0Y,13
11
- nucliadb_sdk-6.3.5.post3980.dist-info/RECORD,,
7
+ nucliadb_sdk/v2/sdk.py,sha256=sakK-_uwarkIL23P7AQXyu18-3vtRRAqx6syZyzBqXo,47068
8
+ nucliadb_sdk-6.3.5.post3990.dist-info/METADATA,sha256=0wGNhFZWHSyz9P21rpQ3zy2hkHCXw8ISXzz4goSAFuI,6695
9
+ nucliadb_sdk-6.3.5.post3990.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
10
+ nucliadb_sdk-6.3.5.post3990.dist-info/top_level.txt,sha256=_dCwt_JnsZ3463lfvc5KcM2wUQJ9aSvKSsAAjGH8R0Y,13
11
+ nucliadb_sdk-6.3.5.post3990.dist-info/RECORD,,