Skip to content

Commit b238cc6

Browse files
committed
fix: python playground
1 parent 227f173 commit b238cc6

File tree

3 files changed

+64
-33
lines changed

3 files changed

+64
-33
lines changed

playground/python/app/search.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
from asyncio import run
21
from os import environ
32

4-
from algoliasearch.search.client import SearchClient
3+
from algoliasearch.search.client import SearchClientSync
54
from algoliasearch.search import __version__
65
from dotenv import load_dotenv
76

87
load_dotenv("../.env")
98

109

11-
async def main():
10+
def main():
1211
print("SearchClient version", __version__)
1312

14-
client = SearchClient(
13+
client = SearchClientSync(
1514
environ.get("ALGOLIA_APPLICATION_ID"), environ.get("ALGOLIA_ADMIN_KEY")
1615
)
1716
print("client initialized", client)
1817

1918
try:
20-
resp = await client.search(search_method_params={
21-
"requests": [{"indexName": "api-clients-automation"}]
22-
})
23-
print(resp.to_dict())
19+
resp = client.save_objects("foo", [{"foo": "bar"}])
20+
print(resp)
21+
22+
for r in resp:
23+
client.wait_for_task(index_name="foo", task_id=r.task_id)
2424
finally:
25-
await client.close()
25+
client.close()
2626

2727
print("client closed")
2828

2929

30-
run(main())
30+
main()

playground/python/poetry.lock

Lines changed: 53 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/playground.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export async function playground({ language, client }: { language: AllLanguage;
3838
await run(`php ${client}.php`, { cwd: 'playground/php/src', language });
3939
break;
4040
case 'python':
41-
await run(`poetry install --sync && poetry run ${client}`, {
41+
await run(`poetry lock --no-update && poetry install --sync && poetry run ${client}`, {
4242
cwd: 'playground/python',
4343
language,
4444
});

0 commit comments

Comments
 (0)