← 返回
未分类

Get My Location

Get current IP location info (country, province, city, coordinates) with multi-source fallback. No API key required.
获取当前 IP 位置信息(国家、省、城市、坐标),多源回退,无需 API 密钥。
etmnb etmnb 来源
未分类 clawhub v1.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 442
下载
💾 0
安装
1
版本
#latest

概述

Get My Location

Get current or specified IP geolocation with three-tier fallback, no API key required.

Usage

# Current IP location
python scripts/location.py

# Query specific IP
python scripts/location.py 8.8.8.8
python scripts/location.py 240e:43d:3d08:33c8:18a2:e45b:ce7a:67de

# JSON output (programmatic use)
python scripts/location.py --json
python scripts/location.py 8.8.8.8 --json

Fallback Chain

PriorityAPIKey RequiredLimit
-----------------------------------
1freegeoip.appNoNone
2api.ipbase.comNo10k/mo
3ip-api.comNo45/min

Each API retries 3 times with 1s delay before falling back to the next.

Output

Human-readable:

📍 你的位置信息
  IP 地址: 222.89.92.62
  国家:   China
  省份:   Henan
  城市:   Xinxiang
  邮编:   453000
  坐标:   35.308777, 113.867203
  时区:   Asia/Shanghai
  数据源: freegeoip.app

JSON (--json):

{
  "ip": "222.89.92.62",
  "country_code": "CN",
  "country_name": "China",
  "region_name": "Henan",
  "city": "Xinxiang",
  "zip_code": "453000",
  "latitude": 35.30877685546875,
  "longitude": 113.86720275878906,
  "time_zone": "Asia/Shanghai"
}

Python Requirements

  • Python 3.6+ (stdlib only — urllib, json, sys)
  • No pip packages needed
  • Works on Windows / macOS / Linux

When to Use

  • User says "my location", "where am i", "get my location"
  • User says "获取我的位置", "我的位置", "我在哪里", etc.
  • Need IP-based geolocation for any purpose

Notes

  • IPv4 and IPv6 supported
  • Accuracy varies: typically city-level (some countries support district-level)
  • For freegeoip/ipbase: freegeoip.app redirects to api.ipbase.com (same data)
  • Exit code 0 on success, 1 if all sources fail

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-05-03 08:34 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 677 📥 326,026
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 72 📥 181,492
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 195 📥 67,437