返回顶部
i

ipinfoIP地理查询

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,142
下载量
免费
免费
2
收藏
概述
安装方式
版本历史

ipinfo

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.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部