← 返回
开发者工具

gettangemperors

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...
查询本地后端API获取唐朝皇帝信息。适用于用户询问唐朝皇帝、需从本地API获取皇帝数据或引用相关信息的场景。
hzlpypy hzlpypy 来源
开发者工具 clawhub v1.0.1 1 版本 100000 Key: 无需
★ 1
Stars
📥 467
下载
💾 9
安装
1
版本
#latest

概述

Tang Emperors API

Overview

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.

Quick Start

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

API Details

  • Base URL: http://127.0.0.1:8080
  • Endpoint: /api/v1/test
  • Method: GET
  • Returns: JSON data about the first three Tang Dynasty emperors

Error Handling

The script includes comprehensive error handling:

  • Connection errors: Backend not running or unreachable
  • Timeout errors: API response timeout (10s default)
  • HTTP errors: Invalid HTTP responses (404, 500, etc.)
  • JSON parsing errors: Malformed response data
  • Unexpected errors: Other runtime errors

Usage Patterns

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)

Resources

scripts/get_tang_emperors.py

Python client for the Tang Emperors API with:

  • get_tang_emperors(): Fetches raw JSON data from API
  • format_emperor_data(): Formats data for human-readable output
  • CLI support with --json flag for raw JSON output
  • Comprehensive error handling and timeout management

The script can be:

  • Executed directly from command line
  • Imported as a module in other Python code
  • Used by Codex for automated API interactions

Notes

  • Ensure the local backend is running before making API calls
  • The API expects a GET request with no parameters
  • Response format may vary; the script handles common patterns (list, dict with 'emperors' key, dict with 'data' key)
  • Default timeout is 10 seconds; adjust in script if needed for your environment

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-03-30 00:17 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

knowledge-management

web-tools-guide

user_ec205dbb
MANDATORY before calling web_search, web_fetch, browser, or opencli. Contains required error-handling procedures (web_se
★ 57 📥 152,282
knowledge-management

Obsidian

steipete
操作 Obsidian 仓库(纯 Markdown 笔记)并通过 obsidian-cli 自动化。
★ 436 📥 104,176
knowledge-management

Prismfy Web Search | Free Google

uroboros1205
OpenClaw的默认网页搜索。使用Prismfy在10个搜索引擎(Google、Reddit、GitHub、arXiv、Hacker News等)搜索网络,含免费套餐。
★ 36 📥 83,909