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 库可以告诉我大概的位置和时区?
基础教程推荐
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
- Discord.py 缺少必需的参数 2022-01-01
- 用 Python 编写 Fortran 无格式文件 2022-01-01
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
- 将 x 轴刻度更改为自定义字符串 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
- 尝试制作WhatsApp机器人 2022-01-01
