闲社服务运行正常AI智能体自动化平台
i

IP地理查询

技能标识:ipinfo

Perform IP geolocation lookups using ipinfo.io API. Convert IP addresses to geographic data including city, region, country, postal code, timezone, and coordinates. Use when geolocating IPs, enriching IP data, or analyzing geographic distribution.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.0
检测标记
后台标记通过
免费
免费获取
2
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

IP地理查询

IPinfo 地理位置

免费IP地理位置API。基础使用无需API密钥(每月5万次请求),可选令牌以获得更高限额。

配置

IPINFO_TOKEN 环境变量是可选的——该技能无需令牌即可使用免费套餐。通过OpenClaw仪表盘UI配置可获得更高速率限制,或手动设置:

  • - 仪表盘UI:在OpenClaw仪表盘中配置 IPINFOTOKEN(可选)
  • 环境变量:export IPINFOTOKEN=your-token
  • 查询参数:?token=YOUR_TOKEN(用于单次请求)

快速查询

单个IP:

bash
curl -s https://ipinfo.io/8.8.8.8

当前IP:

bash
curl -s https://ipinfo.io/json

带令牌(可选,从环境变量获取):

bash
curl -s https://ipinfo.io/8.8.8.8?token=${IPINFO_TOKEN}

或直接传递令牌:

bash
curl -s https://ipinfo.io/8.8.8.8?token=YOUR_TOKEN

响应格式

JSON响应包含:

  • - ip:IP地址
  • hostname:反向DNS主机名
  • city:城市名称
  • region:州/地区
  • country:两位字母国家代码(ISO 3166-1 alpha-2)
  • postal:邮政编码
  • timezone:IANA时区
  • loc:坐标,格式为纬度,经度
  • org:组织/ASN信息

提取特定字段

使用 jq:

bash
curl -s https://ipinfo.io/8.8.8.8 | jq -r .city, .country, .loc

仅国家:

bash
curl -s https://ipinfo.io/8.8.8.8 | jq -r .country

解析坐标:

bash
curl -s https://ipinfo.io/8.8.8.8 | jq -r .loc | tr , \n

批量处理

处理多个IP:

bash
for ip in 8.8.8.8 1.1.1.1 208.67.222.222; do
if [ -n $IPINFO_TOKEN ]; then
echo $ip: $(curl -s https://ipinfo.io/$ip?token=$IPINFO_TOKEN | jq -r .city, .country | tr \n , )
else
echo $ip: $(curl -s https://ipinfo.io/$ip | jq -r .city, .country | tr \n , )
fi
done

Python使用

python
import os
import requests

无令牌(免费套餐)

response = requests.get(https://ipinfo.io/8.8.8.8) data = response.json() print(f{data[city]}, {data[country]}) print(fCoordinates: {data[loc]})

从环境变量获取令牌:

python
import os
import requests

token = os.getenv(IPINFO_TOKEN)
if token:
response = requests.get(https://ipinfo.io/8.8.8.8, params={token: token})
else:
response = requests.get(https://ipinfo.io/8.8.8.8)
data = response.json()

或直接传递令牌:

python
response = requests.get(https://ipinfo.io/8.8.8.8, params={token: YOUR_TOKEN})

速率限制

  • - 免费套餐:每月5万次请求,约1次/秒
  • 带令牌:根据套餐提供更高限制
  • 通过OpenClaw仪表盘UI或环境变量配置 IPINFO_TOKEN

常见用例

  • - 定位IP地址的地理位置
  • 用位置数据丰富IP列表
  • 按国家筛选IP
  • 使用坐标计算IP之间的距离
  • 检测IP的时区

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 ipinfo-1776376642 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 ipinfo-1776376642 技能

通过命令行安装

skillhub install ipinfo-1776376642

下载

⬇ 下载 ipinfo v1.0.0(免费)

文件大小: 1.91 KB | 发布时间: 2026-4-17 14:38

v1.0.0 最新 2026-4-17 14:38
- Initial release of the ipinfo skill for IP geolocation lookups using the ipinfo.io API.
- Supports converting IP addresses to geographic data: city, region, country, postal code, timezone, coordinates, and more.
- No API key required for up to 50,000 requests/month; optional IPINFO_TOKEN for higher rate limits.
- Includes instructions for single and batch IP lookups, extracting fields with jq, and Python usage examples.
- Outlines free and token-authenticated usage, configuration methods, and common use cases.
返回顶部