nucliadb-sdk 6.3.5.post4041__py3-none-any.whl → 6.3.5.post4044__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.
@@ -174,13 +174,13 @@ def nucliadb(pg):
174
174
 
175
175
  @pytest.fixture(scope="session")
176
176
  def sdk(nucliadb: NucliaFixture):
177
- sdk = nucliadb_sdk.NucliaDB(region=nucliadb_sdk.Region.ON_PREM, url=nucliadb.url)
177
+ sdk = nucliadb_sdk.NucliaDB(region="on-prem", url=nucliadb.url)
178
178
  return sdk
179
179
 
180
180
 
181
181
  @pytest.fixture(scope="function")
182
182
  def sdk_async(nucliadb: NucliaFixture):
183
- sdk = nucliadb_sdk.NucliaDBAsync(region=nucliadb_sdk.Region.ON_PREM, url=nucliadb.url)
183
+ sdk = nucliadb_sdk.NucliaDBAsync(region="on-prem", url=nucliadb.url)
184
184
  return sdk
185
185
 
186
186
 
@@ -199,7 +199,7 @@ async def init_fixture(
199
199
  dataset_slug: str,
200
200
  dataset_location: str,
201
201
  ):
202
- sdk = nucliadb_sdk.NucliaDB(region=nucliadb_sdk.Region.ON_PREM, url=nucliadb.url)
202
+ sdk = nucliadb_sdk.NucliaDB(region="on-prem", url=nucliadb.url)
203
203
  slug = uuid.uuid4().hex
204
204
  kb_obj = sdk.create_knowledge_box(slug=slug)
205
205
  kbid = kb_obj.uuid
nucliadb_sdk/v2/sdk.py CHANGED
@@ -792,19 +792,16 @@ class _NucliaDBBase:
792
792
  def __init__(
793
793
  self,
794
794
  *,
795
- region: Region = Region.EUROPE1,
795
+ region: Union[str, Region] = "europe-1",
796
796
  api_key: Optional[str] = None,
797
797
  url: Optional[str] = None,
798
798
  headers: Optional[Dict[str, str]] = None,
799
799
  timeout: Optional[float] = None,
800
800
  ):
801
- try:
802
- self.region: str = Region(region).value
803
- except ValueError:
804
- warnings.warn(
805
- f"Unknown region '{region}'. Supported regions are: {[r.value for r in Region]}"
806
- )
807
- self.region = region # type: ignore
801
+ if isinstance(region, Region):
802
+ warnings.warn(f"Passing Region enum is deprecated. Use the string instead: {region.value}")
803
+ region = str(region.value)
804
+ self.region: str = region
808
805
  self.api_key = api_key
809
806
  headers = headers or {}
810
807
  if self.region == Region.ON_PREM.value:
@@ -878,14 +875,14 @@ class NucliaDB(_NucliaDBBase):
878
875
  Example usage
879
876
 
880
877
  >>> from nucliadb_sdk import *
881
- >>> sdk = NucliaDB(region=Region.EUROPE1, api_key="api-key")
878
+ >>> sdk = NucliaDB(region="europe-1", api_key="api-key")
882
879
  >>> sdk.list_resources(kbid='my-kbid')
883
880
  """
884
881
 
885
882
  def __init__(
886
883
  self,
887
884
  *,
888
- region: Region = Region.EUROPE1,
885
+ region: Union[str, Region] = "europe-1",
889
886
  api_key: Optional[str] = None,
890
887
  url: Optional[str] = None,
891
888
  headers: Optional[Dict[str, str]] = None,
@@ -918,7 +915,7 @@ class NucliaDB(_NucliaDBBase):
918
915
  If you are connecting to a NucliaDB on-prem instance, you will need to specify the URL as follows:
919
916
 
920
917
  >>> from nucliadb_sdk import NucliaDB, Region
921
- >>> sdk = NucliaDB(api_key="api-key", region=Region.ON_PREM, url=\"http://localhost:8080\")
918
+ >>> sdk = NucliaDB(api_key="api-key", url=\"http://localhost:8080\")
922
919
  """ # noqa
923
920
  super().__init__(region=region, api_key=api_key, url=url, headers=headers)
924
921
  self.session = httpx.Client(headers=self.headers, base_url=self.base_url, timeout=timeout)
@@ -1074,14 +1071,14 @@ class NucliaDBAsync(_NucliaDBBase):
1074
1071
  Example usage
1075
1072
 
1076
1073
  >>> from nucliadb_sdk import *
1077
- >>> sdk = NucliaDBAsync(region=Region.EUROPE1, api_key="api-key")
1074
+ >>> sdk = NucliaDBAsync(region="europe-1", api_key="api-key")
1078
1075
  >>> await sdk.list_resources(kbid='my-kbid')
1079
1076
  """
1080
1077
 
1081
1078
  def __init__(
1082
1079
  self,
1083
1080
  *,
1084
- region: Region = Region.EUROPE1,
1081
+ region: Union[str, Region] = "europe-1",
1085
1082
  api_key: Optional[str] = None,
1086
1083
  url: Optional[str] = None,
1087
1084
  headers: Optional[Dict[str, str]] = None,
@@ -1104,15 +1101,15 @@ class NucliaDBAsync(_NucliaDBBase):
1104
1101
  When connecting to the managed NucliaDB cloud service, you can simply configure the SDK with your API key
1105
1102
 
1106
1103
  >>> from nucliadb_sdk import *
1107
- >>> sdk = NucliaDBAsync(api_key="api-key")
1104
+ >>> sdk = NucliaDBAsync(api_key="api-key", region="aws-us-east-2-1")
1108
1105
 
1109
1106
  If the Knowledge Box you are interacting with is public, you don't even need the api key
1110
1107
 
1111
- >>> sdk = NucliaDBAsync()
1108
+ >>> sdk = NucliaDBAsync(region="europe-1")
1112
1109
 
1113
1110
  If you are connecting to a NucliaDB on-prem instance, you will need to specify the URL
1114
1111
 
1115
- >>> sdk = NucliaDBAsync(api_key="api-key", region=Region.ON_PREM, url="https://mycompany.api.com/api/nucliadb")
1112
+ >>> sdk = NucliaDBAsync(api_key="api-key", url="https://mycompany.api.com/api/nucliadb")
1116
1113
  """ # noqa
1117
1114
  super().__init__(region=region, api_key=api_key, url=url, headers=headers)
1118
1115
  self.session = httpx.AsyncClient(headers=self.headers, base_url=self.base_url, timeout=timeout)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb_sdk
3
- Version: 6.3.5.post4041
3
+ Version: 6.3.5.post4044
4
4
  Summary: NucliaDB SDK
5
5
  Author-email: Nuclia <nucliadb@nuclia.com>
6
6
  License: AGPL
@@ -23,7 +23,7 @@ Requires-Dist: httpx
23
23
  Requires-Dist: orjson
24
24
  Requires-Dist: pydantic>=2.6
25
25
  Requires-Dist: nuclia-models>=0.24.2
26
- Requires-Dist: nucliadb-models>=6.3.5.post4041
26
+ Requires-Dist: nucliadb-models>=6.3.5.post4044
27
27
 
28
28
  # NucliaDB SDK
29
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=HrqlUoVHnF1PGn0MrXrBeT_Fjv8kUuNa9SINUXamPq4,7037
4
+ nucliadb_sdk/tests/fixtures.py,sha256=m-mc0KchUBmsHQuK60o9W30gFJdVAnms_LorMdTdEbY,6983
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=sakK-_uwarkIL23P7AQXyu18-3vtRRAqx6syZyzBqXo,47068
8
- nucliadb_sdk-6.3.5.post4041.dist-info/METADATA,sha256=AJ9RzBK-_aA-CMmcVktU0Y0_1Cer2CELgBMcD40KZzs,6695
9
- nucliadb_sdk-6.3.5.post4041.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
10
- nucliadb_sdk-6.3.5.post4041.dist-info/top_level.txt,sha256=_dCwt_JnsZ3463lfvc5KcM2wUQJ9aSvKSsAAjGH8R0Y,13
11
- nucliadb_sdk-6.3.5.post4041.dist-info/RECORD,,
7
+ nucliadb_sdk/v2/sdk.py,sha256=Fn01t9FxD24rcfR1tmvvUfD-sxIzU73DLDAwjUHym_4,47018
8
+ nucliadb_sdk-6.3.5.post4044.dist-info/METADATA,sha256=l6cla2HB485oqtJBXncL23YpTBLn1R85lPuy0JLScuA,6695
9
+ nucliadb_sdk-6.3.5.post4044.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
10
+ nucliadb_sdk-6.3.5.post4044.dist-info/top_level.txt,sha256=_dCwt_JnsZ3463lfvc5KcM2wUQJ9aSvKSsAAjGH8R0Y,13
11
+ nucliadb_sdk-6.3.5.post4044.dist-info/RECORD,,