标签 API 下的文章 - This-PC
首页
文章归档
Search
1
在VPS上安装飞牛OS
49 阅读
2
VPS初始设置
21 阅读
3
Linux使用群晖的ABB套件进行整机备份
19 阅读
4
Windows10没有休眠选项解决办法
17 阅读
5
Python读取其他程序回显
14 阅读
系统相关
Windows
Linux
虚拟化NAS
群晖
PVE
VMware
飞牛
编程相关
Python
Docker
登录
找到
1
篇与
API
相关的结果
2025-01-24
Python-IP归属地查询
百度API API:https://opendata.baidu.com/api.php?query=113.89.235.182&co=&resource_id=6006&oe=utf8 API1:https://opendata.baidu.com/api.php?co=&resource_id=6006&oe=utf8&query=113.89.235.182 响应json: { "status": "0", "t": "", "set_cache_time": "", "data": [ { "ExtendedLocation": "", "OriginQuery": "113.89.235.182", "appinfo": "", "disp_type": 0, "fetchkey": "113.89.235.182", "location": "广东省深圳市 电信", "origip": "113.89.235.182", "origipquery": "113.89.235.182", "resourceid": "6006", "role_id": 0, "shareImage": 1, "showLikeShare": 1, "showlamp": "1", "titlecont": "IP地址查询", "tplt": "ip" } ] }本地数据库 Ip2region GitHub地址 官方示例 # Copyright 2022 The Ip2Region Authors. All rights reserved. # Use of this source code is governed by a Apache2.0-style # license that can be found in the LICENSE file. # from xdbSearcher import XdbSearcher def searchWithFile(): # 1. 创建查询对象 dbPath = "../../data/ip2region.xdb" searcher = XdbSearcher(dbfile=dbPath) # 2. 执行查询 ip = "1.2.3.4" region_str = searcher.searchByIPStr(ip) print(region_str) # 3. 关闭searcher searcher.close() def searchWithVectorIndex(): # 1. 预先加载整个 xdb dbPath = "../../data/ip2region.xdb" vi = XdbSearcher.loadVectorIndexFromFile(dbfile=dbPath) # 2. 使用上面的缓存创建查询对象, 同时也要加载 xdb 文件 searcher = XdbSearcher(dbfile=dbPath, vectorIndex=vi) # 3. 执行查询 ip = "1.2.3.4" region_str = searcher.search(ip) print(region_str) # 4. 关闭searcher searcher.close() def searchWithContent(): # 1. 预先加载整个 xdb dbPath = "../../data/ip2region.xdb"; cb = XdbSearcher.loadContentFromFile(dbfile=dbPath) # 2. 仅需要使用上面的全文件缓存创建查询对象, 不需要传源 xdb 文件 searcher = XdbSearcher(contentBuff=cb) # 3. 执行查询 ip = "1.2.3.4" region_str = searcher.search(ip) print(region_str) # 4. 关闭searcher searcher.close() if __name__ == '__main__': searchWithContent()
系统相关
Python
编程相关
# Python
# API
904666888
1月24日
0
9
0
易航博客