{"skill":{"slug":"gettangemperors","displayName":"gettangemperors","summary":"Query local backend API for Tang Dynasty emperor information. Use when user asks about Tang emperors, needs to fetch emperor data from local API, or referenc...","description":"---\nname: tang-emperors-api\ndescription: Query local backend API for Tang Dynasty emperor information. Use when user asks about Tang emperors, needs to fetch emperor data from local API, or references唐朝皇帝 / 唐朝前3代皇帝 / 唐朝帝王. The API runs at http://127.0.0.1:8080 with GET /api/v1/test endpoint.\n---\n\n# Tang Emperors API\n\n## Overview\n\nThis 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`.\n\n## Quick Start\n\nFetch Tang Dynasty emperor information:\n\n```bash\npython3 scripts/get_tang_emperors.py\n```\n\nOutput formatted as human-readable text:\n```bash\npython3 scripts/get_tang_emperors.py\n```\n\nOutput raw JSON:\n```bash\npython3 scripts/get_tang_emperors.py --json\n```\n\n## API Details\n\n- **Base URL**: `http://127.0.0.1:8080`\n- **Endpoint**: `/api/v1/test`\n- **Method**: GET\n- **Returns**: JSON data about the first three Tang Dynasty emperors\n\n## Error Handling\n\nThe script includes comprehensive error handling:\n\n- **Connection errors**: Backend not running or unreachable\n- **Timeout errors**: API response timeout (10s default)\n- **HTTP errors**: Invalid HTTP responses (404, 500, etc.)\n- **JSON parsing errors**: Malformed response data\n- **Unexpected errors**: Other runtime errors\n\n## Usage Patterns\n\n**Direct API call:**\n```bash\ncurl http://127.0.0.1:8080/api/v1/test\n```\n\n**Via Python script (recommended):**\n```bash\npython3 scripts/get_tang_emperors.py\n```\n\n**Programmatic access in Python:**\n```python\nfrom scripts.get_tang_emperors import get_tang_emperors, format_emperor_data\n\ndata = get_tang_emperors()\nformatted = format_emperor_data(data)\nprint(formatted)\n```\n\n## Resources\n\n### scripts/get_tang_emperors.py\n\nPython client for the Tang Emperors API with:\n\n- `get_tang_emperors()`: Fetches raw JSON data from API\n- `format_emperor_data()`: Formats data for human-readable output\n- CLI support with `--json` flag for raw JSON output\n- Comprehensive error handling and timeout management\n\nThe script can be:\n- Executed directly from command line\n- Imported as a module in other Python code\n- Used by Codex for automated API interactions\n\n## Notes\n\n- Ensure the local backend is running before making API calls\n- The API expects a GET request with no parameters\n- Response format may vary; the script handles common patterns (list, dict with 'emperors' key, dict with 'data' key)\n- Default timeout is 10 seconds; adjust in script if needed for your environment\n","tags":{"latest":"1.0.1"},"stats":{"comments":0,"downloads":517,"installsAllTime":0,"installsCurrent":0,"stars":1,"versions":1},"createdAt":1773148370377,"updatedAt":1778491807445},"latestVersion":{"version":"1.0.1","createdAt":1773148370377,"changelog":"Initial release of Tang Emperors API skill.\n\n- Provides integration with local backend API for information on the first three Tang Dynasty emperors.\n- Python client script with human-readable and raw JSON output options.\n- Robust error handling for connectivity, HTTP errors, and response parsing.\n- Supports direct API calls via curl or programmatic use in Python.\n- Detailed documentation and usage examples included.","license":"MIT-0"},"metadata":null,"owner":{"handle":"hzlpypy","userId":"s174n4ncse0qn0b8qa24swdt5h83gdjc","displayName":"hzll","image":"https://avatars.githubusercontent.com/u/38349058?v=4"},"moderation":null}