-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(clients): expose waitForTasks to batch helpers [skip-bc] (#4030)
- Loading branch information
Showing
17 changed files
with
844 additions
and
646 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
from asyncio import run | ||
from os import environ | ||
|
||
from algoliasearch.search.client import SearchClient | ||
from algoliasearch.search.client import SearchClientSync | ||
from algoliasearch.search import __version__ | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv("../.env") | ||
|
||
|
||
async def main(): | ||
def main(): | ||
print("SearchClient version", __version__) | ||
|
||
client = SearchClient( | ||
client = SearchClientSync( | ||
environ.get("ALGOLIA_APPLICATION_ID"), environ.get("ALGOLIA_ADMIN_KEY") | ||
) | ||
print("client initialized", client) | ||
|
||
try: | ||
resp = await client.search(search_method_params={ | ||
"requests": [{"indexName": "api-clients-automation"}] | ||
}) | ||
print(resp.to_dict()) | ||
resp = client.save_objects("foo", [{"foo": "bar"}]) | ||
print(resp) | ||
|
||
for r in resp: | ||
client.wait_for_task(index_name="foo", task_id=r.task_id) | ||
finally: | ||
await client.close() | ||
client.close() | ||
|
||
print("client closed") | ||
|
||
|
||
run(main()) | ||
main() |
Oops, something went wrong.