GithubHelp home page GithubHelp logo

jackjyq / ip Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 2.0 4.37 MB

考拉IP归属地,可查询用户IP地址及归属地, 及设备型号、操作系统及浏览器版本。

Home Page: https://ip.jackjyq.com/

License: MIT License

Shell 0.69% Python 54.50% CSS 6.56% HTML 24.54% JavaScript 13.71%
ip ip-location user-agent geolocation http-headers ip-address

ip's Introduction

查询我的 IP 地址、归属地、设备类型、操作系统、浏览器版本、屏幕分辨率、经纬度、地理位置等。

快速开始

注:因用到 sh 而不兼容 Windows。此外,由于大陆网路原因,查看 Whois 信息 功能或不可用。

安装

Rye

# 安装 Python 依赖
rye sync

# 下载 ip2region 数据库
rye run ip2region

# 下载 GeoLite2 数据库
rye run geolite2

# 安装 whois
sudo apt install whois

运行

# 调试模式
rye run dev

# 生产模式
rye run prod

API 文档

我的 IP(文本格式)

  • curl 'https://ip.jackjyq.com/text'
  • curl 'https://ip.jackjyq.com/'

我的 IP(JSON 格式)

  • curl 'https://ip.jackjyq.com/json'
  • curl 'https://ip.jackjyq.com/' -H 'Content-Type: application/json'

批量查询 IP 归属地

HTTP POST: https://ip.jackjyq.com/ips

请求:

{
  "ips": ["127.0.0.1", "114.114.114.114", "8.8.8.8"],
  "database": "both"
}

database 选项:

  • both: 默认值,返回完整
  • ip2region: 速度快,请求数量大
  • GeoLite2: 可选

例如:

curl -X POST -H "Content-Type: application/json" -d '{
  "ips": ["127.0.0.1", "114.114.114.114", "8.8.8.8"],
  "database": "both"
}' https://ip.jackjyq.com/ips

返回:

{
  "127.0.0.1": {
    "ip": "127.0.0.1",
    "country": null,
    "region": null,
    "province": null,
    "city": "内网IP",
    "isp": "内网IP",
    "database_name": "ip2region",
    "database_href": "https://gitee.com/lionsoul/ip2region/"
  },
  "114.114.114.114": {
    "ip": "114.114.114.114",
    "country": "**",
    "region": null,
    "province": "江苏省",
    "city": "南京市",
    "isp": null,
    "database_name": "ip2region",
    "database_href": "https://gitee.com/lionsoul/ip2region/"
  },
  "8.8.8.8": {
    "ip": "8.8.8.8",
    "country": "美国",
    "region": null,
    "province": "加州",
    "city": "洛杉矶",
    "isp": null,
    "database_name": "GeoLite2",
    "database_href": "https://www.maxmind.com/"
  }
}

数据源

IP 归属地

经纬度位置

参考

ip's People

Contributors

jackjyq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ip's Issues

better handling the log

somebody is using this project with 10k request /day, the log is growing fast, need a better way to save logs, e.g. sqlite?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.