GeoIP与谷歌应用程序引擎和Python [英] GeoIP with google app engine and python

查看:120
本文介绍了GeoIP与谷歌应用程序引擎和Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将以下功能添加到我的应用程序中。

操作顺序:


  1. 用户转到Web应用程序


  2. Web应用程序根据用户IP地址检测国家和城市


  3. Web应用程序会自动选择用户国家和城市,并向用户显示。

  4. b $ b

    我试图寻找这个,甚至在谷歌应用引擎谷歌组中提出了一个问题,但我找不到一种可靠的方式在谷歌应用引擎中完成这项工作。

    任何人都可以在这里开始我的任何观点?

如果您需要服务器端,那么您需要掌握将IP地址映射到国家/城市的其中一个数据库。这些数据库经常过时,因此通常是商业性的。 Maxmind 为他们的数据库提供了各种许可证,包括我相信的一些免费许可证。



但是,如果您可以将检查移动到客户端,那么在浏览器中,您可以对 Maxmind的免费JSONP API 来获取您的用户的估计位置,然后让您的应用程序使用JavaScript处理决策。


I am trying to add the following feature to my application.

Sequence of actions:

  1. User goes to the web application

  2. Web application detects the country and city based on the users IP address

  3. Web application automatically selects users country and city and shows it to the user.

I tried searching for this and even asked a question in the google app engine google group, but i couldn't find a reliable way to get this done in google app engine.
Does anyone have any points where i can get started on this?

解决方案

If you need to do this server-side then you will need to get hold of one of the databases that map IP addresses to countries/cities. These databases go out of date requenquently and so are usually commercial. Maxmind have various licences for their database including some free ones I believe.

However, if you could move the check on to the client-side, in the browser you could make an ajax call to Maxmind's free JSONP API to fetch the estimated location of your user, and then let your application handle the decisions using javascript.

这篇关于GeoIP与谷歌应用程序引擎和Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆