27 lines
757 B
Python
27 lines
757 B
Python
import asyncio
|
|
import aiohttp
|
|
import json
|
|
|
|
async def test():
|
|
url = "http://localhost:3015/documents/paginated"
|
|
headers = {
|
|
"X-API-Key": "jleu1212",
|
|
"Content-Type": "application/json",
|
|
"X-Workspace": "test"
|
|
}
|
|
data = {
|
|
"page": 1,
|
|
"page_size": 10
|
|
}
|
|
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:
|
|
error = await resp.text()
|
|
print(f"Error: {error}")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test()) |