为了账号安全,请及时绑定邮箱和手机立即绑定

我目前正在尝试创建一个 ip finder 和 location finder

我目前正在尝试创建一个 ip finder 和 location finder

萧十郎 2022-12-27 14:47:19
这是代码:res = requests.get('https://ipinfo.io/')data = res.json()ip = input('Enter Target Ip: ')print(data) 这只会打印出你的 ip 信息,我想让用户在他们想要的任何 ip 上找到信息。
查看完整描述

1 回答

?
喵喔喔

TA贡献1735条经验 获得超5个赞

在此处查看ipstackAPI 。它更适合您的问题,而不是通过使用 等模块来实现。URLlib

请求调用示例 IP 地址:https://api.ipstack.com/134.201.250.155

回应:

{

  "ip": "134.201.250.155",

  "hostname": "134.201.250.155",

  "type": "ipv4",

  "continent_code": "NA",

  "continent_name": "North America",

  "country_code": "US",

  "country_name": "United States",

  "region_code": "CA",

  "region_name": "California",

  "city": "Los Angeles",

  "zip": "90013",

  "latitude": 34.0453,

  "longitude": -118.2413,

  "location": {

    "geoname_id": 5368361,

    "capital": "Washington D.C.",

    "languages": [

        {

          "code": "en",

          "name": "English",

          "native": "English"

        }

    ],

    "country_flag": "https://assets.ipstack.com/images/assets/flags_svg/us.svg",

    "country_flag_emoji": "🇺🇸",

    "country_flag_emoji_unicode": "U+1F1FA U+1F1F8",

    "calling_code": "1",

    "is_eu": false

  },

  "time_zone": {

    "id": "America/Los_Angeles",

    "current_time": "2018-03-29T07:35:08-07:00",

    "gmt_offset": -25200,

    "code": "PDT",

    "is_daylight_saving": true

  },

  "currency": {

    "code": "USD",

    "name": "US Dollar",

    "plural": "US dollars",

    "symbol": "$",

    "symbol_native": "$"

  },

  "connection": {

    "asn": 25876,

    "isp": "Los Angeles Department of Water & Power"

  },

  "security": {

    "is_proxy": false,

    "proxy_type": null,

    "is_crawler": false,

    "crawler_name": null,

    "crawler_type": null,

    "is_tor": false,

    "threat_level": "low",

    "threat_types": null

  }

}


查看完整回答
反对 回复 2022-12-27
  • 1 回答
  • 0 关注
  • 98 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号