algoliasearch client python
4.9.2
الوثائق • Django • منتدى المجتمع • Stack Overflow • الإبلاغ عن خطأ • الأسئلة الشائعة • الدعم
3.8 أولاً ، قم بتثبيت عميل Algolia Python API عبر مدير حزمة PIP:
pip install --upgrade ' algoliasearch>=4.0,<5.0 'يمكنك الآن استيراد عميل Algolia API في مشروعك واللعب معه.
from algoliasearch . search . client import SearchClient
_client = SearchClient ( "YOUR_APP_ID" , "YOUR_API_KEY" )
# Add a new record to your Algolia index
response = await _client . save_object (
index_name = "<YOUR_INDEX_NAME>" ,
body = {
"objectID" : "id" ,
"test" : "val" ,
},
)
# use the class directly
print ( response )
# print the JSON response
print ( response . to_json ())
# Poll the task status to know when it has been indexed
await client . wait_for_task ( index_name = "<YOUR_INDEX_NAME>" , task_id = response . task_id )
# Fetch search results, with typo tolerance
response = await _client . search (
search_method_params = {
"requests" : [
{
"indexName" : "<YOUR_INDEX_NAME>" ,
"query" : "<YOUR_QUERY>" ,
"hitsPerPage" : 50 ,
},
],
},
)
# use the class directly
print ( response )
# print the JSON response
print ( response . to_json ())للحصول على الوثائق الكاملة ، تفضل بزيارة عميل Algolia Python API .
مواجهة قضية؟ قبل التواصل مع الدعم ، نوصي بالتوجه إلى الأسئلة الشائعة الخاصة بنا حيث ستجد إجابات للمشكلات الأكثر شيوعًا و gotchas مع العميل. يمكنك أيضًا فتح مشكلة github
يستضيف هذا المستودع رمز عميل Algolia API الذي تم إنشاؤه لـ Python ، إذا كنت ترغب في المساهمة ، توجه إلى المستودع الرئيسي. يمكنك أيضًا العثور على أدلة مساهمة على موقع الوثائق لدينا.
عميل Algolia Python API هو برنامج مفتوح المصادر مرخصة بموجب ترخيص معهد ماساتشوستس للتكنولوجيا.