Skip to content

Commit 2d9a813

Browse files
committed
chore: playground with transformation
1 parent 7358bf0 commit 2d9a813

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

playground/python/app/search.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from os import environ
22

33
from algoliasearch.search.client import SearchClientSync
4-
from algoliasearch.search import __version__
4+
from algoliasearch.search.config import SearchConfig
55
from dotenv import load_dotenv
66

77
load_dotenv("../.env")
@@ -27,3 +27,29 @@ def main():
2727
client.close()
2828

2929
print("client closed")
30+
31+
print("with transformations")
32+
33+
config = SearchConfig(
34+
environ.get("ALGOLIA_APPLICATION_ID"), environ.get("ALGOLIA_ADMIN_KEY")
35+
)
36+
37+
config.with_transformation("eu")
38+
39+
print("region in playground")
40+
print(config.region)
41+
42+
client = SearchClientSync.create_with_config(config)
43+
client.add_user_agent("playground search with ingestion")
44+
45+
print("user_agent", client._config._user_agent.get())
46+
47+
try:
48+
resp = client.save_objects_with_transformation(
49+
"foo", [{"objectID": "bar"}], wait_for_tasks=True
50+
)
51+
print(resp)
52+
finally:
53+
client.close()
54+
55+
print("client closed")

playground/python/poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

playground/python/requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
argcomplete==3.6.2
2+
click==8.2.1
3+
packaging==25.0
4+
pipx==1.7.1
5+
platformdirs==4.3.8
6+
userpath==1.9.2

0 commit comments

Comments
 (0)