使用Python根据IP地址获取邮政编码
是否可以使用 python / django (不是 geodjango)根据用户 IP 地址查找邮政编码?我假设我必须使用网络服务,但如果可能的话,我真的希望能够查询数据库。
我现在正在使用 geopy,所以如果我能以某种方式集成它那就太酷了。
Is it possible to find the zip code based on a users IP address using python / django (not geodjango)? I assume I would have to use a web service, but I would really like to just be able to query a database if possible.
I am using geopy right now, so it would be cool if I could integrate that somehow.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
http://www.ip2location.com/python.aspx
我没有任何经验有了这个包,但看起来它会做你想要的。
编辑:实际上,这看起来只是搜索他们出售的数据文件 - 所以如果您正在寻找免费的东西,可能没有那么有用。
http://www.ip2location.com/python.aspx
I don't have any experience with this package but it looks like it will do what you want.
EDIT: Actually it looks like this is just searching through a data file that they sell -- so probably not that useful if you are looking for something free.
您无法从 IP 地址收集真实的邮政编码,因为这些邮政编码是在您路由时由 ISP 分配的。
You can't collect a real zip code from an IP address as these are assigned by ISP's when you route threw their connection.