ai-workspace-lab/xworkspace-core-skills / skills/marketplace/autoglm-websearch
autoglm-websearch
Verified使用 AutoGLM Web Search 接口进行网络信息搜索。当用户需要联网搜索、查询最新资讯、检索网页内容或获取实时信息时使用此 skill。 Token 通过本地服务 http://127.0.0.1:53699/get_token 自动获取,无需手动配置环境变量。
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 2.0 KB |
| websearch.py | script | 2.1 KB |
websearch.py
View on GitHub#!/usr/bin/env python3
# websearch.py — AutoGLM Web Search
# 用法: python websearch.py "搜索关键词"
import sys
import json
import hashlib
import time
import urllib.request
# ── 配置 ──────────────────────────────────────────
APP_ID = "100003"
APP_KEY = "38d2391985e2369a5fb8227d8e6cd5e5"
URL = "https://autoglm-api.zhipuai.cn/agentdr/v1/assistant/skills/web-search"
TOKEN_URL = "http://127.0.0.1:53699/get_token"
# ── Step 1: 获取 token ────────────────────────────
try:
with urllib.request.urlopen(TOKEN_URL) as resp:
token = resp.read().decode("utf-8").strip()
except Exception as e:
print(f"ERROR: 无法从本地服务获取 token: {e}")
sys.exit(1)
if not token:
print("ERROR: 获取到的 token 为空。")
sys.exit(1)
# 确保格式为 "Bearer xxx"
if not token.lower().startswith("bearer "):
token = f"Bearer {token}"
# ── Step 2: 读取搜索词 ────────────────────────────
if len(sys.argv) < 2:
print("用法: python websearch.py \"搜索关键词\"")
sys.exit(1)
query = sys.argv[1]
# ── Step 3: 生成签名 Headers ──────────────────────
timestamp = str(int(time.time()))
sign_data = f"{APP_ID}&{timestamp}&{APP_KEY}"
sign = hashlib.md5(sign_data.encode("utf-8")).hexdigest()
# ── Step 4: 发起请求 ──────────────────────────────
payload = json.dumps({"queries": [{"query": query}]}).encode("utf-8")
headers = {
"Authorization": token,
"Content-Type": "application/json",
"X-Auth-Appid": APP_ID,
"X-Auth-TimeStamp": timestamp,
"X-Auth-Sign": sign,
}
req = urllib.request.Request(URL, data=payload, headers=headers, method="POST")
with urllib.request.urlopen(req) as resp:
result = json.loads(resp.read().decode("utf-8"))
print(json.dumps(result, ensure_ascii=False, indent=2))Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |