Files
eosphoros-ai--db-gpt/examples/client/app_crud_example.py
T
wehub-resource-sync d13100ebf3
Update draft releases / main (push) Has been cancelled
Build and push docs image / build-image (push) Has been cancelled
Build Web Application / build-web (macos-latest) (push) Has been cancelled
Build Web Application / build-web (ubuntu-latest) (push) Has been cancelled
Python Code Quality Checks / build (push) Has been cancelled
Test Python / test-python (macos-latest, 3.10) (push) Has been cancelled
Test Python / test-python (macos-latest, 3.11) (push) Has been cancelled
Test Python / test-python (ubuntu-latest, 3.10) (push) Has been cancelled
Test Python / test-python (ubuntu-latest, 3.11) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:27:08 +08:00

35 lines
831 B
Python

"""Client: Simple App CRUD example.
This example demonstrates how to use the dbgpt client to get, list apps.
Example:
.. code-block:: python
DBGPT_API_KEY = "dbgpt"
client = Client(api_key=DBGPT_API_KEY)
# 1. List all apps
res = await list_app(client)
# 2. Get an app
res = await get_app(client, app_id="bf1c7561-13fc-4fe0-bf5d-c22e724766a8")
"""
import asyncio
from dbgpt_client import Client
from dbgpt_client.app import list_app
async def main():
# initialize client
DBGPT_API_KEY = "dbgpt"
client = Client(api_key=DBGPT_API_KEY)
try:
res = await list_app(client)
print(res)
finally:
# explicitly close client to avoid event loop closed error
await client.aclose()
if __name__ == "__main__":
asyncio.run(main())