What python libraries can tell me approximate location and time zone given an IP address?(在给定 IP 地址的情况下,哪些 python 库可以告诉我大概的位置和时区?)
问题描述
希望使用 Python 实现更好的地理位置.
Hostip.info 是一个开源项目,其目标是构建/维护一个数据库将 IP 地址映射到城市.他们的关于页面解释了填充这个数据库所依赖的数据源.
使用 HostIP,有两种方法可以从 IP 地址获取位置数据:
他们还有一个精心设计且易于使用的 RESTFUL API:只需在 i***p=*** 之后传入您的 IP 地址在 GET 请求字符串中):
导入urllibresponse = urllib.urlopen('http://api.hostip.info/get_html.php?ip=12.215.42.19&position=true').read()打印(响应)其次,项目网站还提供完整的数据库供下载.p>
Looking to implement better geo-location with Python.
Hostip.info is an open-source project with the goal to build/maintain a database mapping IP addresses to cities. Their about page explains the data sources relied on to populate this database.
Using HostIP, there are two ways to get location data from an IP address:
They also have a well-designed and easy-to-use RESTFUL API: just pass in your ip address after the i***p=*** in the GET request string):
import urllib
response = urllib.urlopen('http://api.hostip.info/get_html.php?ip=12.215.42.19&position=true').read()
print(response)
Second, the Project Website also makes its complete database available for download.
这篇关于在给定 IP 地址的情况下,哪些 python 库可以告诉我大概的位置和时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在给定 IP 地址的情况下,哪些 python 库可以告诉我大概的位置和时区?
基础教程推荐
- PermissionError: pip 从 8.1.1 升级到 8.1.2 2022-01-01
- PANDA VALUE_COUNTS包含GROUP BY之前的所有值 2022-01-01
- 求两个直方图的卷积 2022-01-01
- 在Python中从Azure BLOB存储中读取文件 2022-01-01
- 使用大型矩阵时禁止 Pycharm 输出中的自动换行符 2022-01-01
- 在同一图形上绘制Bokeh的烛台和音量条 2022-01-01
- 无法导入 Pytorch [WinError 126] 找不到指定的模块 2022-01-01
- Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙? 2022-01-01
- 包装空间模型 2022-01-01
- 修改列表中的数据帧不起作用 2022-01-01
