29 lines
853 B
Python
29 lines
853 B
Python
import asyncio
|
|
import aiohttp
|
|
import json
|
|
|
|
async def get_documents(workspace):
|
|
url = "http://localhost:3015/documents"
|
|
headers = {
|
|
"X-API-Key": "jleu1212",
|
|
"X-Workspace": workspace,
|
|
"accept": "application/json",
|
|
}
|
|
async with aiohttp.ClientSession() as session:
|
|
async with session.get(url, headers=headers) as resp:
|
|
print(f"Documents 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}")
|
|
return resp.status
|
|
|
|
async def main():
|
|
workspace = "test1"
|
|
print("Checking documents after clear...")
|
|
await get_documents(workspace)
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main()) |