meilisearch-python-sdk 5.1.0__py3-none-any.whl → 5.2.0__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 meilisearch-python-sdk might be problematic. Click here for more details.

@@ -4952,9 +4952,9 @@ class Index(_BaseIndex):
4952
4952
 
4953
4953
  Examples
4954
4954
  >>> from meilisearch_python_sdk import Client
4955
- >>> client = Client("http://localhost.com", "masterKey")
4956
- >>> index = client.index("movies")
4957
- >>> index.compact()
4955
+ >>> with Client("http://localhost.com", "masterKey") as client:
4956
+ >>> index = client.index("movies")
4957
+ >>> index.compact()
4958
4958
  """
4959
4959
  response = self._http_requests.post(f"{self._base_url_with_uid}/compact")
4960
4960
  return TaskInfo(**response.json())
@@ -4971,9 +4971,9 @@ class Index(_BaseIndex):
4971
4971
 
4972
4972
  Examples
4973
4973
  >>> from meilisearch_python_sdk import Client
4974
- >>> client = Client("http://localhost.com", "masterKey")
4975
- >>> index = client.index("movies")
4976
- >>> index.delete()
4974
+ >>> with Client("http://localhost.com", "masterKey") as client:
4975
+ >>> index = client.index("movies")
4976
+ >>> index.delete()
4977
4977
  """
4978
4978
  response = self._http_requests.delete(self._base_url_with_uid)
4979
4979
  return TaskInfo(**response.json())
@@ -4990,9 +4990,9 @@ class Index(_BaseIndex):
4990
4990
 
4991
4991
  Examples
4992
4992
  >>> from meilisearch_python_sdk import Client
4993
- >>> client = Client("http://localhost.com", "masterKey")
4994
- >>> index = client.index("movies")
4995
- >>> index.delete_if_exists()
4993
+ >>> with Client("http://localhost.com", "masterKey") as client:
4994
+ >>> index = client.index("movies")
4995
+ >>> index.delete_if_exists()
4996
4996
  """
4997
4997
  response = self.delete()
4998
4998
  status = wait_for_task(self.http_client, response.task_uid, timeout_in_ms=100000)
@@ -5016,9 +5016,9 @@ class Index(_BaseIndex):
5016
5016
 
5017
5017
  Examples
5018
5018
  >>> from meilisearch_python_sdk import Client
5019
- >>> client = Client("http://localhost.com", "masterKey")
5020
- >>> index = client.index("movies")
5021
- >>> updated_index = index.update()
5019
+ >>> with Client("http://localhost.com", "masterKey") as client:
5020
+ >>> index = client.index("movies")
5021
+ >>> updated_index = index.update()
5022
5022
  """
5023
5023
  payload = {"primaryKey": primary_key}
5024
5024
  response = self._http_requests.patch(self._base_url_with_uid, payload)
@@ -5039,9 +5039,9 @@ class Index(_BaseIndex):
5039
5039
 
5040
5040
  Examples
5041
5041
  >>> from meilisearch_python_sdk import Client
5042
- >>> client = Client("http://localhost.com", "masterKey")
5043
- >>> index = client.index("movies")
5044
- >>> index_info = index.fetch_info()
5042
+ >>> with Client("http://localhost.com", "masterKey") as client:
5043
+ >>> index = client.index("movies")
5044
+ >>> index_info = index.fetch_info()
5045
5045
  """
5046
5046
  response = self._http_requests.get(self._base_url_with_uid)
5047
5047
  index_dict = response.json()
@@ -5062,9 +5062,9 @@ class Index(_BaseIndex):
5062
5062
 
5063
5063
  Examples
5064
5064
  >>> from meilisearch_python_sdk import Client
5065
- >>> client = Client("http://localhost.com", "masterKey")
5066
- >>> index = client.index("movies")
5067
- >>> primary_key = index.get_primary_key()
5065
+ >>> with Client("http://localhost.com", "masterKey") as client:
5066
+ >>> index = client.index("movies")
5067
+ >>> primary_key = index.get_primary_key()
5068
5068
  """
5069
5069
  info = self.fetch_info()
5070
5070
  return info.primary_key
@@ -5121,8 +5121,8 @@ class Index(_BaseIndex):
5121
5121
 
5122
5122
  Examples
5123
5123
  >>> from meilisearch_python_sdk import Client
5124
- >>> client = Client("http://localhost.com", "masterKey")
5125
- >>> index = index.create(client, "movies")
5124
+ >>> with Client("http://localhost.com", "masterKey") as client:
5125
+ >>> index = index.create(client, "movies")
5126
5126
  """
5127
5127
  if not primary_key:
5128
5128
  payload = {"uid": uid}
@@ -5166,9 +5166,9 @@ class Index(_BaseIndex):
5166
5166
 
5167
5167
  Examples
5168
5168
  >>> from meilisearch_python_sdk import Client
5169
- >>> client = Client("http://localhost.com", "masterKey")
5170
- >>> index = client.index("movies")
5171
- >>> stats = index.get_stats()
5169
+ >>> with Client("http://localhost.com", "masterKey") as client:
5170
+ >>> index = client.index("movies")
5171
+ >>> stats = index.get_stats()
5172
5172
  """
5173
5173
  response = self._http_requests.get(self._stats_url)
5174
5174
 
@@ -5282,9 +5282,9 @@ class Index(_BaseIndex):
5282
5282
 
5283
5283
  Examples
5284
5284
  >>> from meilisearch_python_sdk import Client
5285
- >>> client = Client("http://localhost.com", "masterKey")
5286
- >>> index = client.index("movies")
5287
- >>> search_results = index.search("Tron")
5285
+ >>> with Client("http://localhost.com", "masterKey") as client:
5286
+ >>> index = client.index("movies")
5287
+ >>> search_results = index.search("Tron")
5288
5288
  """
5289
5289
  if ranking_score_threshold:
5290
5290
  _validate_ranking_score_threshold(ranking_score_threshold)
@@ -5453,13 +5453,13 @@ class Index(_BaseIndex):
5453
5453
 
5454
5454
  Examples
5455
5455
  >>> from meilisearch_python_sdk import Client
5456
- >>> client = Client("http://localhost.com", "masterKey")
5457
- >>> index = client.index("movies")
5458
- >>> search_results = index.search(
5459
- >>> "Tron",
5460
- >>> facet_name="genre",
5461
- >>> facet_query="Sci-fi"
5462
- >>> )
5456
+ >>> with Client("http://localhost.com", "masterKey") as client:
5457
+ >>> index = client.index("movies")
5458
+ >>> search_results = index.search(
5459
+ >>> "Tron",
5460
+ >>> facet_name="genre",
5461
+ >>> facet_query="Sci-fi"
5462
+ >>> )
5463
5463
  """
5464
5464
  if ranking_score_threshold:
5465
5465
  _validate_ranking_score_threshold(ranking_score_threshold)
@@ -5572,9 +5572,9 @@ class Index(_BaseIndex):
5572
5572
 
5573
5573
  Examples
5574
5574
  >>> from meilisearch_python_sdk import Client
5575
- >>> client = Client("http://localhost.com", "masterKey")
5576
- >>> index = client.index("movies")
5577
- >>> search_results = index.search_similar_documents("123")
5575
+ >>> with Client("http://localhost.com", "masterKey") as client:
5576
+ >>> index = client.index("movies")
5577
+ >>> search_results = index.search_similar_documents("123")
5578
5578
  """
5579
5579
  payload = {
5580
5580
  "id": id,
@@ -5621,9 +5621,9 @@ class Index(_BaseIndex):
5621
5621
 
5622
5622
  Examples
5623
5623
  >>> from meilisearch_python_sdk import Client
5624
- >>> client = Client("http://localhost.com", "masterKey")
5625
- >>> index = client.index("movies")
5626
- >>> document = index.get_document("1234")
5624
+ >>> with Client("http://localhost.com", "masterKey") as client:
5625
+ >>> index = client.index("movies")
5626
+ >>> document = index.get_document("1234")
5627
5627
  """
5628
5628
  parameters: JsonDict = {}
5629
5629
 
@@ -5671,9 +5671,9 @@ class Index(_BaseIndex):
5671
5671
 
5672
5672
  Examples
5673
5673
  >>> from meilisearch_python_sdk import Client
5674
- >>> client = Client("http://localhost.com", "masterKey")
5675
- >>> index = client.index("movies")
5676
- >>> documents = index.get_documents()
5674
+ >>> with Client("http://localhost.com", "masterKey") as client:
5675
+ >>> index = client.index("movies")
5676
+ >>> documents = index.get_documents()
5677
5677
  """
5678
5678
  parameters: JsonDict = {
5679
5679
  "offset": offset,
@@ -5732,9 +5732,9 @@ class Index(_BaseIndex):
5732
5732
  >>> {"id": 1, "title": "Movie 1", "genre": "comedy"},
5733
5733
  >>> {"id": 2, "title": "Movie 2", "genre": "drama"},
5734
5734
  >>> ]
5735
- >>> client = Client("http://localhost.com", "masterKey")
5736
- >>> index = client.index("movies")
5737
- >>> index.add_documents(documents)
5735
+ >>> with Client("http://localhost.com", "masterKey") as client:
5736
+ >>> index = client.index("movies")
5737
+ >>> index.add_documents(documents)
5738
5738
  """
5739
5739
  if primary_key:
5740
5740
  url = _build_encoded_url(self._documents_url, {"primaryKey": primary_key})
@@ -5791,9 +5791,9 @@ class Index(_BaseIndex):
5791
5791
  >>> {"id": 1, "title": "Movie 1", "genre": "comedy"},
5792
5792
  >>> {"id": 2, "title": "Movie 2", "genre": "drama"},
5793
5793
  >>> ]
5794
- >>> client = Client("http://localhost.com", "masterKey")
5795
- >>> index = client.index("movies")
5796
- >>> index.add_documents_in_batches(documents)
5794
+ >>> with Client("http://localhost.com", "masterKey") as client:
5795
+ >>> index = client.index("movies")
5796
+ >>> index.add_documents_in_batches(documents)
5797
5797
  """
5798
5798
  return [
5799
5799
  self.add_documents(x, primary_key, compress=compress)
@@ -5838,9 +5838,9 @@ class Index(_BaseIndex):
5838
5838
  >>> from pathlib import Path
5839
5839
  >>> from meilisearch_python_sdk import Client
5840
5840
  >>> directory_path = Path("/path/to/directory/containing/files")
5841
- >>> client = Client("http://localhost.com", "masterKey")
5842
- >>> index = client.index("movies")
5843
- >>> index.add_documents_from_directory(directory_path)
5841
+ >>> with Client("http://localhost.com", "masterKey") as client:
5842
+ >>> index = client.index("movies")
5843
+ >>> index.add_documents_from_directory(directory_path)
5844
5844
  """
5845
5845
  directory = Path(directory_path) if isinstance(directory_path, str) else directory_path
5846
5846
 
@@ -5914,9 +5914,9 @@ class Index(_BaseIndex):
5914
5914
  >>> from pathlib import Path
5915
5915
  >>> from meilisearch_python_sdk import Client
5916
5916
  >>> directory_path = Path("/path/to/directory/containing/files")
5917
- >>> client = Client("http://localhost.com", "masterKey")
5918
- >>> index = client.index("movies")
5919
- >>> index.add_documents_from_directory_in_batches(directory_path)
5917
+ >>> with Client("http://localhost.com", "masterKey") as client:
5918
+ >>> index = client.index("movies")
5919
+ >>> index.add_documents_from_directory_in_batches(directory_path)
5920
5920
  """
5921
5921
  directory = Path(directory_path) if isinstance(directory_path, str) else directory_path
5922
5922
 
@@ -5987,9 +5987,9 @@ class Index(_BaseIndex):
5987
5987
  >>> from pathlib import Path
5988
5988
  >>> from meilisearch_python_sdk import Client
5989
5989
  >>> file_path = Path("/path/to/file.json")
5990
- >>> client = Client("http://localhost.com", "masterKey")
5991
- >>> index = client.index("movies")
5992
- >>> index.add_documents_from_file(file_path)
5990
+ >>> with Client("http://localhost.com", "masterKey") as client:
5991
+ >>> index = client.index("movies")
5992
+ >>> index.add_documents_from_file(file_path)
5993
5993
  """
5994
5994
  documents = _load_documents_from_file(file_path, json_handler=self._json_handler)
5995
5995
 
@@ -6029,9 +6029,9 @@ class Index(_BaseIndex):
6029
6029
  >>> from pathlib import Path
6030
6030
  >>> from meilisearch_python_sdk import Client
6031
6031
  >>> file_path = Path("/path/to/file.json")
6032
- >>> client = Client("http://localhost.com", "masterKey")
6033
- >>> index = client.index("movies")
6034
- >>> index.add_documents_from_file_in_batches(file_path)
6032
+ >>> with Client("http://localhost.com", "masterKey") as client:
6033
+ >>> index = client.index("movies")
6034
+ >>> index.add_documents_from_file_in_batches(file_path)
6035
6035
  """
6036
6036
  documents = _load_documents_from_file(
6037
6037
  file_path, csv_delimiter, json_handler=self._json_handler
@@ -6080,9 +6080,9 @@ class Index(_BaseIndex):
6080
6080
  >>> from pathlib import Path
6081
6081
  >>> from meilisearch_python_sdk import Client
6082
6082
  >>> file_path = Path("/path/to/file.csv")
6083
- >>> client = Client("http://localhost.com", "masterKey")
6084
- >>> index = client.index("movies")
6085
- >>> index.add_documents_from_raw_file(file_path)
6083
+ >>> with Client("http://localhost.com", "masterKey") as client:
6084
+ >>> index = client.index("movies")
6085
+ >>> index.add_documents_from_raw_file(file_path)
6086
6086
  """
6087
6087
  upload_path = Path(file_path) if isinstance(file_path, str) else file_path
6088
6088
  if not upload_path.exists():
@@ -6148,9 +6148,9 @@ class Index(_BaseIndex):
6148
6148
 
6149
6149
  Examples
6150
6150
  >>> from meilisearch_python_sdk import Client
6151
- >>> client = Client("http://localhost.com", "masterKey")
6152
- >>> index = client.index("movies")
6153
- >>> index.edit_documents("doc.title = `${doc.title.to_upper()}`")
6151
+ >>> with Client("http://localhost.com", "masterKey") as client:
6152
+ >>> index = client.index("movies")
6153
+ >>> index.edit_documents("doc.title = `${doc.title.to_upper()}`")
6154
6154
  """
6155
6155
  url = f"{self._documents_url}/edit"
6156
6156
  payload: JsonDict = {"function": function}
@@ -6193,9 +6193,9 @@ class Index(_BaseIndex):
6193
6193
  >>> {"id": 1, "title": "Movie 1", "genre": "comedy"},
6194
6194
  >>> {"id": 2, "title": "Movie 2", "genre": "drama"},
6195
6195
  >>> ]
6196
- >>> client = Client("http://localhost.com", "masterKey")
6197
- >>> index = client.index("movies")
6198
- >>> index.update_documents(documents)
6196
+ >>> with Client("http://localhost.com", "masterKey") as client:
6197
+ >>> index = client.index("movies")
6198
+ >>> index.update_documents(documents)
6199
6199
  """
6200
6200
  if primary_key:
6201
6201
  url = _build_encoded_url(self._documents_url, {"primaryKey": primary_key})
@@ -6256,9 +6256,9 @@ class Index(_BaseIndex):
6256
6256
  >>> {"id": 1, "title": "Movie 1", "genre": "comedy"},
6257
6257
  >>> {"id": 2, "title": "Movie 2", "genre": "drama"},
6258
6258
  >>> ]
6259
- >>> client = Client("http://localhost.com", "masterKey")
6260
- >>> index = client.index("movies")
6261
- >>> index.update_documents_in_batches(documents)
6259
+ >>> with Client("http://localhost.com", "masterKey") client:
6260
+ >>> index = client.index("movies")
6261
+ >>> index.update_documents_in_batches(documents)
6262
6262
  """
6263
6263
  return [
6264
6264
  self.update_documents(x, primary_key, compress=compress)
@@ -6303,9 +6303,9 @@ class Index(_BaseIndex):
6303
6303
  >>> from pathlib import Path
6304
6304
  >>> from meilisearch_python_sdk import Client
6305
6305
  >>> directory_path = Path("/path/to/directory/containing/files")
6306
- >>> client = Client("http://localhost.com", "masterKey")
6307
- >>> index = client.index("movies")
6308
- >>> index.update_documents_from_directory(directory_path)
6306
+ >>> with Client("http://localhost.com", "masterKey") as client:
6307
+ >>> index = client.index("movies")
6308
+ >>> index.update_documents_from_directory(directory_path)
6309
6309
  """
6310
6310
  directory = Path(directory_path) if isinstance(directory_path, str) else directory_path
6311
6311
 
@@ -6378,9 +6378,9 @@ class Index(_BaseIndex):
6378
6378
  >>> from pathlib import Path
6379
6379
  >>> from meilisearch_python_sdk import Client
6380
6380
  >>> directory_path = Path("/path/to/directory/containing/files")
6381
- >>> client = Client("http://localhost.com", "masterKey")
6382
- >>> index = client.index("movies")
6383
- >>> index.update_documents_from_directory_in_batches(directory_path)
6381
+ >>> with Client("http://localhost.com", "masterKey") as client:
6382
+ >>> index = client.index("movies")
6383
+ >>> index.update_documents_from_directory_in_batches(directory_path)
6384
6384
  """
6385
6385
  directory = Path(directory_path) if isinstance(directory_path, str) else directory_path
6386
6386
 
@@ -6453,9 +6453,9 @@ class Index(_BaseIndex):
6453
6453
  >>> from pathlib import Path
6454
6454
  >>> from meilisearch_python_sdk import Client
6455
6455
  >>> file_path = Path("/path/to/file.json")
6456
- >>> client = Client("http://localhost.com", "masterKey") as client:
6457
- >>> index = client.index("movies")
6458
- >>> index.update_documents_from_file(file_path)
6456
+ >>> with Client("http://localhost.com", "masterKey") as client:
6457
+ >>> index = client.index("movies")
6458
+ >>> index.update_documents_from_file(file_path)
6459
6459
  """
6460
6460
  documents = _load_documents_from_file(
6461
6461
  file_path, csv_delimiter, json_handler=self._json_handler
@@ -6492,9 +6492,9 @@ class Index(_BaseIndex):
6492
6492
  >>> from pathlib import Path
6493
6493
  >>> from meilisearch_python_sdk import Client
6494
6494
  >>> file_path = Path("/path/to/file.json")
6495
- >>> client = Client("http://localhost.com", "masterKey") as client:
6496
- >>> index = client.index("movies")
6497
- >>> index.update_documents_from_file_in_batches(file_path)
6495
+ >>> with Client("http://localhost.com", "masterKey") as client:
6496
+ >>> index = client.index("movies")
6497
+ >>> index.update_documents_from_file_in_batches(file_path)
6498
6498
  """
6499
6499
  documents = _load_documents_from_file(file_path, json_handler=self._json_handler)
6500
6500
 
@@ -6541,9 +6541,9 @@ class Index(_BaseIndex):
6541
6541
  >>> from pathlib import Path
6542
6542
  >>> from meilisearch_python_sdk import Client
6543
6543
  >>> file_path = Path("/path/to/file.csv")
6544
- >>> client = Client("http://localhost.com", "masterKey")
6545
- >>> index = client.index("movies")
6546
- >>> index.update_documents_from_raw_file(file_path)
6544
+ >>> with Client("http://localhost.com", "masterKey") as client:
6545
+ >>> index = client.index("movies")
6546
+ >>> index.update_documents_from_raw_file(file_path)
6547
6547
  """
6548
6548
  upload_path = Path(file_path) if isinstance(file_path, str) else file_path
6549
6549
  if not upload_path.exists():
@@ -6600,9 +6600,9 @@ class Index(_BaseIndex):
6600
6600
 
6601
6601
  Examples
6602
6602
  >>> from meilisearch_python_sdk import Client
6603
- >>> client = Client("http://localhost.com", "masterKey")
6604
- >>> index = client.index("movies")
6605
- >>> index.delete_document("1234")
6603
+ >>> with Client("http://localhost.com", "masterKey") as client:
6604
+ >>> index = client.index("movies")
6605
+ >>> index.delete_document("1234")
6606
6606
  """
6607
6607
  if self._pre_delete_document_plugins:
6608
6608
  Index._run_plugins(
@@ -6633,9 +6633,9 @@ class Index(_BaseIndex):
6633
6633
 
6634
6634
  Examples
6635
6635
  >>> from meilisearch_python_sdk import Client
6636
- >>> client = Client("http://localhost.com", "masterKey")
6637
- >>> index = client.index("movies")
6638
- >>> index.delete_documents(["1234", "5678"])
6636
+ >>> with Client("http://localhost.com", "masterKey") as client:
6637
+ >>> index = client.index("movies")
6638
+ >>> index.delete_documents(["1234", "5678"])
6639
6639
  """
6640
6640
  if self._pre_delete_documents_plugins:
6641
6641
  Index._run_plugins(self._pre_delete_documents_plugins, Event.PRE, ids=ids)
@@ -6666,9 +6666,9 @@ class Index(_BaseIndex):
6666
6666
 
6667
6667
  Examples
6668
6668
  >>> from meilisearch_python_sdk import Client
6669
- >>> client = Client("http://localhost.com", "masterKey")
6670
- >>> index = client.index("movies")
6671
- >>> index.delete_documents_by_filter("genre=horor"))
6669
+ >>> with Client("http://localhost.com", "masterKey") as client:
6670
+ >>> index = client.index("movies")
6671
+ >>> index.delete_documents_by_filter("genre=horor"))
6672
6672
  """
6673
6673
  if self._pre_delete_documents_by_filter_plugins:
6674
6674
  Index._run_plugins(
@@ -6705,14 +6705,14 @@ class Index(_BaseIndex):
6705
6705
 
6706
6706
  Examples
6707
6707
  >>> from meilisearch_python_sdk import Client
6708
- >>> client = Client("http://localhost.com", "masterKey")
6709
- >>> index = client.index("movies")
6710
- >>> index.delete_documents_in_batches_by_filter(
6711
- >>> [
6712
- >>> "genre=horor"),
6713
- >>> "release_date=1520035200"),
6714
- >>> ]
6715
- >>> )
6708
+ >>> with Client("http://localhost.com", "masterKey") as client:
6709
+ >>> index = client.index("movies")
6710
+ >>> index.delete_documents_in_batches_by_filter(
6711
+ >>> [
6712
+ >>> "genre=horor"),
6713
+ >>> "release_date=1520035200"),
6714
+ >>> ]
6715
+ >>> )
6716
6716
  """
6717
6717
  return [self.delete_documents_by_filter(filter) for filter in filters]
6718
6718
 
@@ -6728,9 +6728,9 @@ class Index(_BaseIndex):
6728
6728
 
6729
6729
  Examples
6730
6730
  >>> from meilisearch_python_sdk import Client
6731
- >>> client = Client("http://localhost.com", "masterKey")
6732
- >>> index = client.index("movies")
6733
- >>> index.delete_all_document()
6731
+ >>> with Client("http://localhost.com", "masterKey") as client:
6732
+ >>> index = client.index("movies")
6733
+ >>> index.delete_all_document()
6734
6734
  """
6735
6735
  if self._pre_delete_all_documents_plugins:
6736
6736
  Index._run_plugins(self._pre_delete_all_documents_plugins, Event.PRE)
@@ -6758,9 +6758,9 @@ class Index(_BaseIndex):
6758
6758
 
6759
6759
  Examples
6760
6760
  >>> from meilisearch_python_sdk import Client
6761
- >>> client = Client("http://localhost.com", "masterKey")
6762
- >>> index = client.index("movies")
6763
- >>> settings = index.get_settings()
6761
+ >>> with Client("http://localhost.com", "masterKey") as client:
6762
+ >>> index = client.index("movies")
6763
+ >>> settings = index.get_settings()
6764
6764
  """
6765
6765
  response = self._http_requests.get(self._settings_url)
6766
6766
  response_json = response.json()
@@ -6810,9 +6810,9 @@ class Index(_BaseIndex):
6810
6810
  >>> displayed_attributes=["title", "description", "genre", "release_date"],
6811
6811
  >>> sortable_attributes=["title", "release_date"],
6812
6812
  >>> )
6813
- >>> client = Client("http://localhost.com", "masterKey")
6814
- >>> index = client.index("movies")
6815
- >>> index.update_settings(new_settings)
6813
+ >>> with Client("http://localhost.com", "masterKey") as client:
6814
+ >>> index = client.index("movies")
6815
+ >>> index.update_settings(new_settings)
6816
6816
  """
6817
6817
  body_dict = {
6818
6818
  k: v
@@ -6835,9 +6835,9 @@ class Index(_BaseIndex):
6835
6835
 
6836
6836
  Examples
6837
6837
  >>> from meilisearch_python_sdk import Client
6838
- >>> client = Client("http://localhost.com", "masterKey")
6839
- >>> index = client.index("movies")
6840
- >>> index.reset_settings()
6838
+ >>> with Client("http://localhost.com", "masterKey") as client:
6839
+ >>> index = client.index("movies")
6840
+ >>> index.reset_settings()
6841
6841
  """
6842
6842
  response = self._http_requests.delete(self._settings_url)
6843
6843
 
@@ -6855,9 +6855,9 @@ class Index(_BaseIndex):
6855
6855
 
6856
6856
  Examples
6857
6857
  >>> from meilisearch_python_sdk import Client
6858
- >>> client = Client("http://localhost.com", "masterKey")
6859
- >>> index = client.index("movies")
6860
- >>> ranking_rules = index.get_ranking_rules()
6858
+ >>> with Client("http://localhost.com", "masterKey") as client:
6859
+ >>> index = client.index("movies")
6860
+ >>> ranking_rules = index.get_ranking_rules()
6861
6861
  """
6862
6862
  response = self._http_requests.get(f"{self._settings_url}/ranking-rules")
6863
6863
 
@@ -6889,9 +6889,9 @@ class Index(_BaseIndex):
6889
6889
  >>> "release_date:desc",
6890
6890
  >>> "rank:desc",
6891
6891
  >>> ],
6892
- >>> client = Client("http://localhost.com", "masterKey")
6893
- >>> index = client.index("movies")
6894
- >>> index.update_ranking_rules(ranking_rules)
6892
+ >>> with Client("http://localhost.com", "masterKey") as client:
6893
+ >>> index = client.index("movies")
6894
+ >>> index.update_ranking_rules(ranking_rules)
6895
6895
  """
6896
6896
  response = self._http_requests.put(
6897
6897
  f"{self._settings_url}/ranking-rules", ranking_rules, compress=compress
@@ -6911,9 +6911,9 @@ class Index(_BaseIndex):
6911
6911
 
6912
6912
  Examples
6913
6913
  >>> from meilisearch_python_sdk import Client
6914
- >>> client = Client("http://localhost.com", "masterKey")
6915
- >>> index = client.index("movies")
6916
- >>> index.reset_ranking_rules()
6914
+ >>> with Client("http://localhost.com", "masterKey") as client:
6915
+ >>> index = client.index("movies")
6916
+ >>> index.reset_ranking_rules()
6917
6917
  """
6918
6918
  response = self._http_requests.delete(f"{self._settings_url}/ranking-rules")
6919
6919
 
@@ -6932,9 +6932,9 @@ class Index(_BaseIndex):
6932
6932
 
6933
6933
  Examples
6934
6934
  >>> from meilisearch_python_sdk import Client
6935
- >>> client = Client("http://localhost.com", "masterKey")
6936
- >>> index = client.index("movies")
6937
- >>> distinct_attribute = index.get_distinct_attribute()
6935
+ >>> with Client("http://localhost.com", "masterKey") as client:
6936
+ >>> index = client.index("movies")
6937
+ >>> distinct_attribute = index.get_distinct_attribute()
6938
6938
  """
6939
6939
  response = self._http_requests.get(f"{self._settings_url}/distinct-attribute")
6940
6940
 
@@ -6959,9 +6959,9 @@ class Index(_BaseIndex):
6959
6959
 
6960
6960
  Examples
6961
6961
  >>> from meilisearch_python_sdk import Client
6962
- >>> client = Client("http://localhost.com", "masterKey")
6963
- >>> index = client.index("movies")
6964
- >>> index.update_distinct_attribute("url")
6962
+ >>> with Client("http://localhost.com", "masterKey") as client:
6963
+ >>> index = client.index("movies")
6964
+ >>> index.update_distinct_attribute("url")
6965
6965
  """
6966
6966
  response = self._http_requests.put(
6967
6967
  f"{self._settings_url}/distinct-attribute", body, compress=compress
@@ -6981,9 +6981,9 @@ class Index(_BaseIndex):
6981
6981
 
6982
6982
  Examples
6983
6983
  >>> from meilisearch_python_sdk import Client
6984
- >>> client = Client("http://localhost.com", "masterKey")
6985
- >>> index = client.index("movies")
6986
- >>> index.reset_distinct_attributes()
6984
+ >>> with Client("http://localhost.com", "masterKey") as client:
6985
+ >>> index = client.index("movies")
6986
+ >>> index.reset_distinct_attributes()
6987
6987
  """
6988
6988
  response = self._http_requests.delete(f"{self._settings_url}/distinct-attribute")
6989
6989
 
@@ -7001,9 +7001,9 @@ class Index(_BaseIndex):
7001
7001
 
7002
7002
  Examples
7003
7003
  >>> from meilisearch_python_sdk import Client
7004
- >>> client = Client("http://localhost.com", "masterKey")
7005
- >>> index = client.index("movies")
7006
- >>> searchable_attributes = index.get_searchable_attributes()
7004
+ >>> with Client("http://localhost.com", "masterKey") as client:
7005
+ >>> index = client.index("movies")
7006
+ >>> searchable_attributes = index.get_searchable_attributes()
7007
7007
  """
7008
7008
  response = self._http_requests.get(f"{self._settings_url}/searchable-attributes")
7009
7009
 
@@ -7025,9 +7025,9 @@ class Index(_BaseIndex):
7025
7025
 
7026
7026
  Examples
7027
7027
  >>> from meilisearch_python_sdk import Client
7028
- >>> client = Client("http://localhost.com", "masterKey")
7029
- >>> index = client.index("movies")
7030
- >>> index.update_searchable_attributes(["title", "description", "genre"])
7028
+ >>> with Client("http://localhost.com", "masterKey") as client:
7029
+ >>> index = client.index("movies")
7030
+ >>> index.update_searchable_attributes(["title", "description", "genre"])
7031
7031
  """
7032
7032
  response = self._http_requests.put(
7033
7033
  f"{self._settings_url}/searchable-attributes", body, compress=compress
@@ -7047,9 +7047,9 @@ class Index(_BaseIndex):
7047
7047
 
7048
7048
  Examples
7049
7049
  >>> from meilisearch_python_sdk import Client
7050
- >>> client = Client("http://localhost.com", "masterKey")
7051
- >>> index = client.index("movies")
7052
- >>> index.reset_searchable_attributes()
7050
+ >>> with Client("http://localhost.com", "masterKey") as client:
7051
+ >>> index = client.index("movies")
7052
+ >>> index.reset_searchable_attributes()
7053
7053
  """
7054
7054
  response = self._http_requests.delete(f"{self._settings_url}/searchable-attributes")
7055
7055
 
@@ -7067,9 +7067,9 @@ class Index(_BaseIndex):
7067
7067
 
7068
7068
  Examples
7069
7069
  >>> from meilisearch_python_sdk import Client
7070
- >>> client = Client("http://localhost.com", "masterKey")
7071
- >>> index = client.index("movies")
7072
- >>> displayed_attributes = index.get_displayed_attributes()
7070
+ >>> with Client("http://localhost.com", "masterKey") as client:
7071
+ >>> index = client.index("movies")
7072
+ >>> displayed_attributes = index.get_displayed_attributes()
7073
7073
  """
7074
7074
  response = self._http_requests.get(f"{self._settings_url}/displayed-attributes")
7075
7075
 
@@ -7091,11 +7091,11 @@ class Index(_BaseIndex):
7091
7091
 
7092
7092
  Examples
7093
7093
  >>> from meilisearch_python_sdk import Client
7094
- >>> client = Client("http://localhost.com", "masterKey")
7095
- >>> index = client.index("movies")
7096
- >>> index.update_displayed_attributes(
7097
- >>> ["title", "description", "genre", "release_date"]
7098
- >>> )
7094
+ >>> with Client("http://localhost.com", "masterKey") as client:
7095
+ >>> index = client.index("movies")
7096
+ >>> index.update_displayed_attributes(
7097
+ >>> ["title", "description", "genre", "release_date"]
7098
+ >>> )
7099
7099
  """
7100
7100
  response = self._http_requests.put(
7101
7101
  f"{self._settings_url}/displayed-attributes", body, compress=compress
@@ -7115,9 +7115,9 @@ class Index(_BaseIndex):
7115
7115
 
7116
7116
  Examples
7117
7117
  >>> from meilisearch_python_sdk import Client
7118
- >>> client = Client("http://localhost.com", "masterKey")
7119
- >>> index = client.index("movies")
7120
- >>> index.reset_displayed_attributes()
7118
+ >>> with Client("http://localhost.com", "masterKey") as client:
7119
+ >>> index = client.index("movies")
7120
+ >>> index.reset_displayed_attributes()
7121
7121
  """
7122
7122
  response = self._http_requests.delete(f"{self._settings_url}/displayed-attributes")
7123
7123
 
@@ -7135,9 +7135,9 @@ class Index(_BaseIndex):
7135
7135
 
7136
7136
  Examples
7137
7137
  >>> from meilisearch_python_sdk import Client
7138
- >>> client = Client("http://localhost.com", "masterKey")
7139
- >>> index = client.index("movies")
7140
- >>> stop_words = index.get_stop_words()
7138
+ >>> with Client("http://localhost.com", "masterKey") as client:
7139
+ >>> index = client.index("movies")
7140
+ >>> stop_words = index.get_stop_words()
7141
7141
  """
7142
7142
  response = self._http_requests.get(f"{self._settings_url}/stop-words")
7143
7143
 
@@ -7162,9 +7162,9 @@ class Index(_BaseIndex):
7162
7162
 
7163
7163
  Examples
7164
7164
  >>> from meilisearch_python_sdk import Client
7165
- >>> client = Client("http://localhost.com", "masterKey")
7166
- >>> index = client.index("movies")
7167
- >>> index.update_stop_words(["the", "a", "an"])
7165
+ >>> with Client("http://localhost.com", "masterKey") as client:
7166
+ >>> index = client.index("movies")
7167
+ >>> index.update_stop_words(["the", "a", "an"])
7168
7168
  """
7169
7169
  response = self._http_requests.put(
7170
7170
  f"{self._settings_url}/stop-words", body, compress=compress
@@ -7184,9 +7184,9 @@ class Index(_BaseIndex):
7184
7184
 
7185
7185
  Examples
7186
7186
  >>> from meilisearch_python_sdk import Client
7187
- >>> client = Client("http://localhost.com", "masterKey")
7188
- >>> index = client.index("movies")
7189
- >>> index.reset_stop_words()
7187
+ >>> with Client("http://localhost.com", "masterKey") as client:
7188
+ >>> index = client.index("movies")
7189
+ >>> index.reset_stop_words()
7190
7190
  """
7191
7191
  response = self._http_requests.delete(f"{self._settings_url}/stop-words")
7192
7192
 
@@ -7204,9 +7204,9 @@ class Index(_BaseIndex):
7204
7204
 
7205
7205
  Examples
7206
7206
  >>> from meilisearch_python_sdk import Client
7207
- >>> client = Client("http://localhost.com", "masterKey")
7208
- >>> index = client.index("movies")
7209
- >>> synonyms = index.get_synonyms()
7207
+ >>> with Client("http://localhost.com", "masterKey") as client:
7208
+ >>> index = client.index("movies")
7209
+ >>> synonyms = index.get_synonyms()
7210
7210
  """
7211
7211
  response = self._http_requests.get(f"{self._settings_url}/synonyms")
7212
7212
 
@@ -7230,11 +7230,11 @@ class Index(_BaseIndex):
7230
7230
 
7231
7231
  Examples
7232
7232
  >>> from meilisearch_python_sdk import Client
7233
- >>> client = Client("http://localhost.com", "masterKey") as client:
7234
- >>> index = client.index("movies")
7235
- >>> index.update_synonyms(
7236
- >>> {"wolverine": ["xmen", "logan"], "logan": ["wolverine"]}
7237
- >>> )
7233
+ >>> with Client("http://localhost.com", "masterKey") as client:
7234
+ >>> index = client.index("movies")
7235
+ >>> index.update_synonyms(
7236
+ >>> {"wolverine": ["xmen", "logan"], "logan": ["wolverine"]}
7237
+ >>> )
7238
7238
  """
7239
7239
  response = self._http_requests.put(
7240
7240
  f"{self._settings_url}/synonyms", body, compress=compress
@@ -7254,9 +7254,9 @@ class Index(_BaseIndex):
7254
7254
 
7255
7255
  Examples
7256
7256
  >>> from meilisearch_python_sdk import Client
7257
- >>> client = Client("http://localhost.com", "masterKey")
7258
- >>> index = client.index("movies")
7259
- >>> index.reset_synonyms()
7257
+ >>> with Client("http://localhost.com", "masterKey") as client:
7258
+ >>> index = client.index("movies")
7259
+ >>> index.reset_synonyms()
7260
7260
  """
7261
7261
  response = self._http_requests.delete(f"{self._settings_url}/synonyms")
7262
7262
 
@@ -7274,9 +7274,9 @@ class Index(_BaseIndex):
7274
7274
 
7275
7275
  Examples
7276
7276
  >>> from meilisearch_python_sdk import Client
7277
- >>> client = Client("http://localhost.com", "masterKey")
7278
- >>> index = client.index("movies")
7279
- >>> filterable_attributes = index.get_filterable_attributes()
7277
+ >>> with Client("http://localhost.com", "masterKey") as client:
7278
+ >>> index = client.index("movies")
7279
+ >>> filterable_attributes = index.get_filterable_attributes()
7280
7280
  """
7281
7281
  response = self._http_requests.get(f"{self._settings_url}/filterable-attributes")
7282
7282
 
@@ -7317,9 +7317,9 @@ class Index(_BaseIndex):
7317
7317
 
7318
7318
  Examples
7319
7319
  >>> from meilisearch_python_sdk import Client
7320
- >>> client = Client("http://localhost.com", "masterKey")
7321
- >>> index = client.index("movies")
7322
- >>> index.update_filterable_attributes(["genre", "director"])
7320
+ >>> with Client("http://localhost.com", "masterKey") as client:
7321
+ >>> index = client.index("movies")
7322
+ >>> index.update_filterable_attributes(["genre", "director"])
7323
7323
  """
7324
7324
  payload: list[str | JsonDict] = []
7325
7325
 
@@ -7347,9 +7347,9 @@ class Index(_BaseIndex):
7347
7347
 
7348
7348
  Examples
7349
7349
  >>> from meilisearch_python_sdk import Client
7350
- >>> client = Client("http://localhost.com", "masterKey")
7351
- >>> index = client.index("movies")
7352
- >>> index.reset_filterable_attributes()
7350
+ >>> with Client("http://localhost.com", "masterKey") as client:
7351
+ >>> index = client.index("movies")
7352
+ >>> index.reset_filterable_attributes()
7353
7353
  """
7354
7354
  response = self._http_requests.delete(f"{self._settings_url}/filterable-attributes")
7355
7355
 
@@ -7367,9 +7367,9 @@ class Index(_BaseIndex):
7367
7367
 
7368
7368
  Examples
7369
7369
  >>> from meilisearch_python_sdk import Client
7370
- >>> client = Client("http://localhost.com", "masterKey")
7371
- >>> index = client.index("movies")
7372
- >>> sortable_attributes = index.get_sortable_attributes()
7370
+ >>> with Client("http://localhost.com", "masterKey") as client:
7371
+ >>> index = client.index("movies")
7372
+ >>> sortable_attributes = index.get_sortable_attributes()
7373
7373
  """
7374
7374
  response = self._http_requests.get(f"{self._settings_url}/sortable-attributes")
7375
7375
 
@@ -7393,9 +7393,9 @@ class Index(_BaseIndex):
7393
7393
 
7394
7394
  Examples
7395
7395
  >>> from meilisearch_python_sdk import Client
7396
- >>> client = Client("http://localhost.com", "masterKey")
7397
- >>> index = client.index("movies")
7398
- >>> index.update_sortable_attributes(["title", "release_date"])
7396
+ >>> with Client("http://localhost.com", "masterKey") as client:
7397
+ >>> index = client.index("movies")
7398
+ >>> index.update_sortable_attributes(["title", "release_date"])
7399
7399
  """
7400
7400
  response = self._http_requests.put(
7401
7401
  f"{self._settings_url}/sortable-attributes", sortable_attributes, compress=compress
@@ -7415,9 +7415,9 @@ class Index(_BaseIndex):
7415
7415
 
7416
7416
  Examples
7417
7417
  >>> from meilisearch_python_sdk import Client
7418
- >>> client = Client("http://localhost.com", "masterKey")
7419
- >>> index = client.index("movies")
7420
- >>> index.reset_sortable_attributes()
7418
+ >>> with Client("http://localhost.com", "masterKey") as client:
7419
+ >>> index = client.index("movies")
7420
+ >>> index.reset_sortable_attributes()
7421
7421
  """
7422
7422
  response = self._http_requests.delete(f"{self._settings_url}/sortable-attributes")
7423
7423
 
@@ -7435,9 +7435,9 @@ class Index(_BaseIndex):
7435
7435
 
7436
7436
  Examples
7437
7437
  >>> from meilisearch_python_sdk import Client
7438
- >>> client = Client("http://localhost.com", "masterKey")
7439
- >>> index = client.index("movies")
7440
- >>> sortable_attributes = index.get_typo_tolerance()
7438
+ >>> with Client("http://localhost.com", "masterKey") as client:
7439
+ >>> index = client.index("movies")
7440
+ >>> sortable_attributes = index.get_typo_tolerance()
7441
7441
  """
7442
7442
  response = self._http_requests.get(f"{self._settings_url}/typo-tolerance")
7443
7443
 
@@ -7461,10 +7461,10 @@ class Index(_BaseIndex):
7461
7461
 
7462
7462
  Examples
7463
7463
  >>> from meilisearch_python_sdk import Client
7464
- >>> client = Client("http://localhost.com", "masterKey")
7465
- >>> index = client.index("movies")
7466
- >>> TypoTolerance(enabled=False)
7467
- >>> index.update_typo_tolerance()
7464
+ >>> with Client("http://localhost.com", "masterKey") as client:
7465
+ >>> index = client.index("movies")
7466
+ >>> TypoTolerance(enabled=False)
7467
+ >>> index.update_typo_tolerance()
7468
7468
  """
7469
7469
  response = self._http_requests.patch(
7470
7470
  f"{self._settings_url}/typo-tolerance",
@@ -7486,9 +7486,9 @@ class Index(_BaseIndex):
7486
7486
 
7487
7487
  Examples
7488
7488
  >>> from meilisearch_python_sdk import Client
7489
- >>> client = Client("http://localhost.com", "masterKey")
7490
- >>> index = client.index("movies")
7491
- >>> index.reset_typo_tolerance()
7489
+ >>> with Client("http://localhost.com", "masterKey") as client:
7490
+ >>> index = client.index("movies")
7491
+ >>> index.reset_typo_tolerance()
7492
7492
  """
7493
7493
  response = self._http_requests.delete(f"{self._settings_url}/typo-tolerance")
7494
7494
 
@@ -7506,9 +7506,9 @@ class Index(_BaseIndex):
7506
7506
 
7507
7507
  Examples
7508
7508
  >>> from meilisearch_python_sdk import Client
7509
- >>> client = Client("http://localhost.com", "masterKey")
7510
- >>> index = client.index("movies")
7511
- >>> faceting = index.get_faceting()
7509
+ >>> with Client("http://localhost.com", "masterKey") as client:
7510
+ >>> index = client.index("movies")
7511
+ >>> faceting = index.get_faceting()
7512
7512
  """
7513
7513
  response = self._http_requests.get(f"{self._settings_url}/faceting")
7514
7514
 
@@ -7530,9 +7530,9 @@ class Index(_BaseIndex):
7530
7530
 
7531
7531
  Examples
7532
7532
  >>> from meilisearch_python_sdk import Client
7533
- >>> client = Client("http://localhost.com", "masterKey")
7534
- >>> index = client.index("movies")
7535
- >>> index.update_faceting(faceting=Faceting(max_values_per_facet=100))
7533
+ >>> with Client("http://localhost.com", "masterKey") as client:
7534
+ >>> index = client.index("movies")
7535
+ >>> index.update_faceting(faceting=Faceting(max_values_per_facet=100))
7536
7536
  """
7537
7537
  response = self._http_requests.patch(
7538
7538
  f"{self._settings_url}/faceting",
@@ -7554,9 +7554,9 @@ class Index(_BaseIndex):
7554
7554
 
7555
7555
  Examples
7556
7556
  >>> from meilisearch_python_sdk import Client
7557
- >>> client = Client("http://localhost.com", "masterKey")
7558
- >>> index = client.index("movies")
7559
- >>> index.reset_faceting()
7557
+ >>> with Client("http://localhost.com", "masterKey") as client:
7558
+ >>> index = client.index("movies")
7559
+ >>> index.reset_faceting()
7560
7560
  """
7561
7561
  response = self._http_requests.delete(f"{self._settings_url}/faceting")
7562
7562
 
@@ -7574,9 +7574,9 @@ class Index(_BaseIndex):
7574
7574
 
7575
7575
  Examples
7576
7576
  >>> from meilisearch_async_client import Client
7577
- >>> client = Client("http://localhost.com", "masterKey")
7578
- >>> index = client.index("movies")
7579
- >>> pagination_settings = index.get_pagination()
7577
+ >>> with Client("http://localhost.com", "masterKey") as client:
7578
+ >>> index = client.index("movies")
7579
+ >>> pagination_settings = index.get_pagination()
7580
7580
  """
7581
7581
  response = self._http_requests.get(f"{self._settings_url}/pagination")
7582
7582
 
@@ -7599,9 +7599,9 @@ class Index(_BaseIndex):
7599
7599
  Examples
7600
7600
  >>> from meilisearch_python_sdk import Client
7601
7601
  >>> from meilisearch_python_sdk.models.settings import Pagination
7602
- >>> client = Client("http://localhost.com", "masterKey")
7603
- >>> index = client.index("movies")
7604
- >>> index.update_pagination(settings=Pagination(max_total_hits=123))
7602
+ >>> with Client("http://localhost.com", "masterKey") as client:
7603
+ >>> index = client.index("movies")
7604
+ >>> index.update_pagination(settings=Pagination(max_total_hits=123))
7605
7605
  """
7606
7606
  response = self._http_requests.patch(
7607
7607
  f"{self._settings_url}/pagination",
@@ -7623,9 +7623,9 @@ class Index(_BaseIndex):
7623
7623
 
7624
7624
  Examples
7625
7625
  >>> from meilisearch_async_client import Client
7626
- >>> client = Client("http://localhost.com", "masterKey")
7627
- >>> index = client.index("movies")
7628
- >>> index.reset_pagination()
7626
+ >>> with Client("http://localhost.com", "masterKey") as client:
7627
+ >>> index = client.index("movies")
7628
+ >>> index.reset_pagination()
7629
7629
  """
7630
7630
  response = self._http_requests.delete(f"{self._settings_url}/pagination")
7631
7631
 
@@ -7643,9 +7643,9 @@ class Index(_BaseIndex):
7643
7643
 
7644
7644
  Examples
7645
7645
  >>> from meilisearch_async_client import Client
7646
- >>> client = Client("http://localhost.com", "masterKey")
7647
- >>> index = client.index("movies")
7648
- >>> separator_token_settings = index.get_separator_tokens()
7646
+ >>> with Client("http://localhost.com", "masterKey") as client:
7647
+ >>> index = client.index("movies")
7648
+ >>> separator_token_settings = index.get_separator_tokens()
7649
7649
  """
7650
7650
  response = self._http_requests.get(f"{self._settings_url}/separator-tokens")
7651
7651
 
@@ -7669,9 +7669,9 @@ class Index(_BaseIndex):
7669
7669
 
7670
7670
  Examples
7671
7671
  >>> from meilisearch_python_sdk import Client
7672
- >>> client = Client("http://localhost.com", "masterKey")
7673
- >>> index = client.index("movies")
7674
- >>> index.update_separator_tokens(separator_tokenes=["|", "/")
7672
+ >>> with Client("http://localhost.com", "masterKey") as client:
7673
+ >>> index = client.index("movies")
7674
+ >>> index.update_separator_tokens(separator_tokenes=["|", "/")
7675
7675
  """
7676
7676
  response = self._http_requests.put(
7677
7677
  f"{self._settings_url}/separator-tokens", separator_tokens, compress=compress
@@ -7691,9 +7691,9 @@ class Index(_BaseIndex):
7691
7691
 
7692
7692
  Examples
7693
7693
  >>> from meilisearch_async_client import Client
7694
- >>> client = Client("http://localhost.com", "masterKey")
7695
- >>> index = client.index("movies")
7696
- >>> index.reset_separator_tokens()
7694
+ >>> with Client("http://localhost.com", "masterKey") as client:
7695
+ >>> index = client.index("movies")
7696
+ >>> index.reset_separator_tokens()
7697
7697
  """
7698
7698
  response = self._http_requests.delete(f"{self._settings_url}/separator-tokens")
7699
7699
 
@@ -7711,9 +7711,9 @@ class Index(_BaseIndex):
7711
7711
 
7712
7712
  Examples
7713
7713
  >>> from meilisearch_async_client import Client
7714
- >>> client = Client("http://localhost.com", "masterKey")
7715
- >>> index = client.index("movies")
7716
- >>> non_separator_token_settings = index.get_non_separator_tokens()
7714
+ >>> with Client("http://localhost.com", "masterKey") as client:
7715
+ >>> index = client.index("movies")
7716
+ >>> non_separator_token_settings = index.get_non_separator_tokens()
7717
7717
  """
7718
7718
  response = self._http_requests.get(f"{self._settings_url}/non-separator-tokens")
7719
7719
 
@@ -7737,9 +7737,9 @@ class Index(_BaseIndex):
7737
7737
 
7738
7738
  Examples
7739
7739
  >>> from meilisearch_python_sdk import Client
7740
- >>> client = Client("http://localhost.com", "masterKey")
7741
- >>> index = client.index("movies")
7742
- >>> index.update_non_separator_tokens(non_separator_tokens=["@", "#")
7740
+ >>> with Client("http://localhost.com", "masterKey") as client:
7741
+ >>> index = client.index("movies")
7742
+ >>> index.update_non_separator_tokens(non_separator_tokens=["@", "#")
7743
7743
  """
7744
7744
  response = self._http_requests.put(
7745
7745
  f"{self._settings_url}/non-separator-tokens", non_separator_tokens, compress=compress
@@ -7759,9 +7759,9 @@ class Index(_BaseIndex):
7759
7759
 
7760
7760
  Examples
7761
7761
  >>> from meilisearch_async_client import Client
7762
- >>> client = Client("http://localhost.com", "masterKey")
7763
- >>> index = client.index("movies")
7764
- >>> index.reset_non_separator_tokens()
7762
+ >>> with Client("http://localhost.com", "masterKey") as client:
7763
+ >>> index = client.index("movies")
7764
+ >>> index.reset_non_separator_tokens()
7765
7765
  """
7766
7766
  response = self._http_requests.delete(f"{self._settings_url}/non-separator-tokens")
7767
7767
 
@@ -7779,9 +7779,9 @@ class Index(_BaseIndex):
7779
7779
 
7780
7780
  Examples
7781
7781
  >>> from meilisearch_async_client import Client
7782
- >>> client = Client("http://localhost.com", "masterKey")
7783
- >>> index = client.index("movies")
7784
- >>> search_cutoff_ms_settings = index.get_search_cutoff_ms()
7782
+ >>> with Client("http://localhost.com", "masterKey") as client:
7783
+ >>> index = client.index("movies")
7784
+ >>> search_cutoff_ms_settings = index.get_search_cutoff_ms()
7785
7785
  """
7786
7786
  response = self._http_requests.get(f"{self._settings_url}/search-cutoff-ms")
7787
7787
 
@@ -7803,9 +7803,9 @@ class Index(_BaseIndex):
7803
7803
 
7804
7804
  Examples
7805
7805
  >>> from meilisearch_python_sdk import Client
7806
- >>> client = Client("http://localhost.com", "masterKey")
7807
- >>> index = client.index("movies")
7808
- >>> index.update_search_cutoff_ms(100)
7806
+ >>> with Client("http://localhost.com", "masterKey") as client:
7807
+ >>> index = client.index("movies")
7808
+ >>> index.update_search_cutoff_ms(100)
7809
7809
  """
7810
7810
  response = self._http_requests.put(
7811
7811
  f"{self._settings_url}/search-cutoff-ms", search_cutoff_ms, compress=compress
@@ -7825,9 +7825,9 @@ class Index(_BaseIndex):
7825
7825
 
7826
7826
  Examples
7827
7827
  >>> from meilisearch_async_client import Client
7828
- >>> client = Client("http://localhost.com", "masterKey")
7829
- >>> index = client.index("movies")
7830
- >>> index.reset_search_cutoff_ms()
7828
+ >>> with Client("http://localhost.com", "masterKey") as client:
7829
+ >>> index = client.index("movies")
7830
+ >>> index.reset_search_cutoff_ms()
7831
7831
  """
7832
7832
  response = self._http_requests.delete(f"{self._settings_url}/search-cutoff-ms")
7833
7833
 
@@ -7845,9 +7845,9 @@ class Index(_BaseIndex):
7845
7845
 
7846
7846
  Examples
7847
7847
  >>> from meilisearch_async_client import Client
7848
- >>> client = Client("http://localhost.com", "masterKey")
7849
- >>> index = client.index("movies")
7850
- >>> word_dictionary = index.get_word_dictionary()
7848
+ >>> with Client("http://localhost.com", "masterKey") as client:
7849
+ >>> index = client.index("movies")
7850
+ >>> word_dictionary = index.get_word_dictionary()
7851
7851
  """
7852
7852
  response = self._http_requests.get(f"{self._settings_url}/dictionary")
7853
7853
 
@@ -7869,9 +7869,9 @@ class Index(_BaseIndex):
7869
7869
 
7870
7870
  Examples
7871
7871
  >>> from meilisearch_python_sdk import Client
7872
- >>> client = Client("http://localhost.com", "masterKey")
7873
- >>> index = client.index("movies")
7874
- >>> index.update_word_dictionary(dictionary=["S.O.S", "S.O")
7872
+ >>> with Client("http://localhost.com", "masterKey") as client:
7873
+ >>> index = client.index("movies")
7874
+ >>> index.update_word_dictionary(dictionary=["S.O.S", "S.O")
7875
7875
  """
7876
7876
  response = self._http_requests.put(
7877
7877
  f"{self._settings_url}/dictionary", dictionary, compress=compress
@@ -7891,9 +7891,9 @@ class Index(_BaseIndex):
7891
7891
 
7892
7892
  Examples
7893
7893
  >>> from meilisearch_async_client import Client
7894
- >>> client = Client("http://localhost.com", "masterKey")
7895
- >>> index = client.index("movies")
7896
- >>> index.reset_word_dictionary()
7894
+ >>> with Client("http://localhost.com", "masterKey") as client:
7895
+ >>> index = client.index("movies")
7896
+ >>> index.reset_word_dictionary()
7897
7897
  """
7898
7898
  response = self._http_requests.delete(f"{self._settings_url}/dictionary")
7899
7899
 
@@ -7911,9 +7911,9 @@ class Index(_BaseIndex):
7911
7911
 
7912
7912
  Examples
7913
7913
  >>> from meilisearch_async_client import Client
7914
- >>> client = Client("http://localhost.com", "masterKey")
7915
- >>> index = client.index("movies")
7916
- >>> proximity_precision = index.get_proximity_precision()
7914
+ >>> with Client("http://localhost.com", "masterKey") as client:
7915
+ >>> index = client.index("movies")
7916
+ >>> proximity_precision = index.get_proximity_precision()
7917
7917
  """
7918
7918
  response = self._http_requests.get(f"{self._settings_url}/proximity-precision")
7919
7919
 
@@ -7938,9 +7938,9 @@ class Index(_BaseIndex):
7938
7938
  Examples
7939
7939
  >>> from meilisearch_python_sdk import Client
7940
7940
  >>> from meilisearch_python_sdk.models.settings import ProximityPrecision
7941
- >>> client = Client("http://localhost.com", "masterKey")
7942
- >>> index = client.index("movies")
7943
- >>> index.update_proximity_precision(ProximityPrecision.BY_ATTRIBUTE)
7941
+ >>> with Client("http://localhost.com", "masterKey") as client:
7942
+ >>> index = client.index("movies")
7943
+ >>> index.update_proximity_precision(ProximityPrecision.BY_ATTRIBUTE)
7944
7944
  """
7945
7945
  response = self._http_requests.put(
7946
7946
  f"{self._settings_url}/proximity-precision",
@@ -7962,9 +7962,9 @@ class Index(_BaseIndex):
7962
7962
 
7963
7963
  Examples
7964
7964
  >>> from meilisearch_async_client import Client
7965
- >>> client = Client("http://localhost.com", "masterKey")
7966
- >>> index = client.index("movies")
7967
- >>> index.reset_proximity_precision()
7965
+ >>> with Client("http://localhost.com", "masterKey") as client:
7966
+ >>> index = client.index("movies")
7967
+ >>> index.reset_proximity_precision()
7968
7968
  """
7969
7969
  response = self._http_requests.delete(f"{self._settings_url}/proximity-precision")
7970
7970
 
@@ -7982,9 +7982,9 @@ class Index(_BaseIndex):
7982
7982
 
7983
7983
  Examples
7984
7984
  >>> from meilisearch_async_client import Client
7985
- >>> client = Client("http://localhost.com", "masterKey")
7986
- >>> index = client.index("movies")
7987
- >>> embedders = await index.get_embedders()
7985
+ >>> with Client("http://localhost.com", "masterKey") as client:
7986
+ >>> index = client.index("movies")
7987
+ >>> embedders = await index.get_embedders()
7988
7988
  """
7989
7989
  response = self._http_requests.get(f"{self._settings_url}/embedders")
7990
7990
 
@@ -8007,11 +8007,11 @@ class Index(_BaseIndex):
8007
8007
  Examples
8008
8008
  >>> from meilisearch_python_sdk import Client
8009
8009
  >>> from meilisearch_python_sdk.models.settings import Embedders, UserProvidedEmbedder
8010
- >>> client = Client("http://localhost.com", "masterKey")
8011
- >>> index = client.index("movies")
8012
- >>> index.update_embedders(
8013
- >>> Embedders(embedders={dimensions=512)})
8014
- >>> )
8010
+ >>> with Client("http://localhost.com", "masterKey") as client:
8011
+ >>> index = client.index("movies")
8012
+ >>> index.update_embedders(
8013
+ >>> Embedders(embedders={dimensions=512)})
8014
+ >>> )
8015
8015
  """
8016
8016
  payload = {}
8017
8017
  for key, embedder in embedders.embedders.items():
@@ -8040,9 +8040,9 @@ class Index(_BaseIndex):
8040
8040
 
8041
8041
  Examples
8042
8042
  >>> from meilisearch_async_client import Client
8043
- >>> client = AsyncClient("http://localhost.com", "masterKey")
8044
- >>> index = client.index("movies")
8045
- >>> index.reset_embedders()
8043
+ >>> with Client("http://localhost.com", "masterKey") as client:
8044
+ >>> index = client.index("movies")
8045
+ >>> index.reset_embedders()
8046
8046
  """
8047
8047
  response = self._http_requests.delete(f"{self._settings_url}/embedders")
8048
8048
 
@@ -8060,9 +8060,9 @@ class Index(_BaseIndex):
8060
8060
 
8061
8061
  Examples
8062
8062
  >>> from meilisearch_async_client import AsyncClient
8063
- >>> client = Client("http://localhost.com", "masterKey")
8064
- >>> index = client.index("movies")
8065
- >>> localized_attributes = await index.get_localized_attributes()
8063
+ >>> with Client("http://localhost.com", "masterKey") as client:
8064
+ >>> index = client.index("movies")
8065
+ >>> localized_attributes = await index.get_localized_attributes()
8066
8066
  """
8067
8067
  response = self._http_requests.get(f"{self._settings_url}/localized-attributes")
8068
8068
 
@@ -8092,12 +8092,12 @@ class Index(_BaseIndex):
8092
8092
  >>> from meilisearch_python_sdk.models.settings import LocalizedAttributes
8093
8093
  >>>
8094
8094
  >>>
8095
- >>> client = Client("http://localhost.com", "masterKey")
8096
- >>> index = client.index("movies")
8097
- >>> index.update_localized_attributes([
8098
- >>> LocalizedAttributes(locales=["eng", "spa"], attribute_patterns=["*"]),
8099
- >>> LocalizedAttributes(locales=["ita"], attribute_patterns=["*_it"]),
8100
- >>> ])
8095
+ >>> with Client("http://localhost.com", "masterKey") as client:
8096
+ >>> index = client.index("movies")
8097
+ >>> index.update_localized_attributes([
8098
+ >>> LocalizedAttributes(locales=["eng", "spa"], attribute_patterns=["*"]),
8099
+ >>> LocalizedAttributes(locales=["ita"], attribute_patterns=["*_it"]),
8100
+ >>> ])
8101
8101
  """
8102
8102
  payload = [x.model_dump(by_alias=True) for x in localized_attributes]
8103
8103
  response = self._http_requests.put(
@@ -8138,9 +8138,9 @@ class Index(_BaseIndex):
8138
8138
 
8139
8139
  Examples
8140
8140
  >>> from meilisearch_async_client import Client
8141
- >>> client = Client("http://localhost.com", "masterKey")
8142
- >>> index = client.index("movies")
8143
- >>> facet_search = await index.get_facet_search()
8141
+ >>> with Client("http://localhost.com", "masterKey") as client:
8142
+ >>> index = client.index("movies")
8143
+ >>> facet_search = await index.get_facet_search()
8144
8144
  """
8145
8145
  response = self._http_requests.get(f"{self._settings_url}/facet-search")
8146
8146
 
@@ -8162,9 +8162,9 @@ class Index(_BaseIndex):
8162
8162
 
8163
8163
  Examples
8164
8164
  >>> from meilisearch_python_sdk import Client
8165
- >>> client = Client("http://localhost.com", "masterKey")
8166
- >>> index = client.index("movies")
8167
- >>> index.update_facet_search(True)
8165
+ >>> with Client("http://localhost.com", "masterKey") as client:
8166
+ >>> index = client.index("movies")
8167
+ >>> index.update_facet_search(True)
8168
8168
  """
8169
8169
  response = self._http_requests.put(
8170
8170
  f"{self._settings_url}/facet-search",
@@ -8186,9 +8186,9 @@ class Index(_BaseIndex):
8186
8186
 
8187
8187
  Examples
8188
8188
  >>> from meilisearch_async_client import Client
8189
- >>> client = Client("http://localhost.com", "masterKey")
8190
- >>> index = client.index("movies")
8191
- >>> await index.reset_facet_search()
8189
+ >>> with Client("http://localhost.com", "masterKey") as client:
8190
+ >>> index = client.index("movies")
8191
+ >>> await index.reset_facet_search()
8192
8192
  """
8193
8193
  response = self._http_requests.delete(f"{self._settings_url}/facet-search")
8194
8194
 
@@ -8206,9 +8206,9 @@ class Index(_BaseIndex):
8206
8206
 
8207
8207
  Examples
8208
8208
  >>> from meilisearch_async_client import Client
8209
- >>> client = Client("http://localhost.com", "masterKey")
8210
- >>> index = client.index("movies")
8211
- >>> prefix_search = index.get_prefix_search()
8209
+ >>> with Client("http://localhost.com", "masterKey") as client:
8210
+ >>> index = client.index("movies")
8211
+ >>> prefix_search = index.get_prefix_search()
8212
8212
  """
8213
8213
  response = self._http_requests.get(f"{self._settings_url}/prefix-search")
8214
8214
 
@@ -8235,9 +8235,9 @@ class Index(_BaseIndex):
8235
8235
 
8236
8236
  Examples
8237
8237
  >>> from meilisearch_python_sdk import Client
8238
- >>> client = Client("http://localhost.com", "masterKey")
8239
- >>> index = client.index("movies")
8240
- >>> index.update_prefix_search("disabled")
8238
+ >>> with Client("http://localhost.com", "masterKey") as client:
8239
+ >>> index = client.index("movies")
8240
+ >>> index.update_prefix_search("disabled")
8241
8241
  """
8242
8242
  response = self._http_requests.put(
8243
8243
  f"{self._settings_url}/prefix-search",
@@ -8259,9 +8259,9 @@ class Index(_BaseIndex):
8259
8259
 
8260
8260
  Examples
8261
8261
  >>> from meilisearch_async_client import Client
8262
- >>> client = Client("http://localhost.com", "masterKey")
8263
- >>> index = client.index("movies")
8264
- >>> index.reset_prefix_search()
8262
+ >>> with Client("http://localhost.com", "masterKey") as client:
8263
+ >>> index = client.index("movies")
8264
+ >>> index.reset_prefix_search()
8265
8265
  """
8266
8266
  response = self._http_requests.delete(f"{self._settings_url}/prefix-search")
8267
8267