workspace working
This commit is contained in:
29
test_retrieval_workspace_test1.py
Normal file
29
test_retrieval_workspace_test1.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import asyncio
|
||||
import aiohttp
|
||||
import json
|
||||
|
||||
async def test():
|
||||
url = "http://localhost:3015/search"
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
"X-Workspace": "test1",
|
||||
"X-API-Key": "jleu1212"
|
||||
}
|
||||
data = {
|
||||
"query": "what is the minimum safe working distance",
|
||||
"mode": "mix",
|
||||
"return_raw_data": True,
|
||||
"use_keywords": False
|
||||
}
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.post(url, headers=headers, json=data) as resp:
|
||||
print(f"Status: {resp.status}")
|
||||
if resp.status == 200:
|
||||
result = await resp.json()
|
||||
print(json.dumps(result, indent=2))
|
||||
else:
|
||||
text = await resp.text()
|
||||
print(f"Error: {text}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(test())
|
||||
Reference in New Issue
Block a user