This skill provides integration with a local backend API that returns information about the first three emperors of the Tang Dynasty (唐朝前3代皇帝). The API is deployed locally at http://127.0.0.1:8080 with the endpoint GET /api/v1/test.
Fetch Tang Dynasty emperor information:
python3 scripts/get_tang_emperors.py
Output formatted as human-readable text:
python3 scripts/get_tang_emperors.py
Output raw JSON:
python3 scripts/get_tang_emperors.py --json
http://127.0.0.1:8080/api/v1/testThe script includes comprehensive error handling:
Direct API call:
curl http://127.0.0.1:8080/api/v1/test
Via Python script (recommended):
python3 scripts/get_tang_emperors.py
Programmatic access in Python:
from scripts.get_tang_emperors import get_tang_emperors, format_emperor_data
data = get_tang_emperors()
formatted = format_emperor_data(data)
print(formatted)
Python client for the Tang Emperors API with:
get_tang_emperors(): Fetches raw JSON data from APIformat_emperor_data(): Formats data for human-readable output--json flag for raw JSON outputThe script can be:
共 1 个版本