On Dec 17, 7:28 pm, Devel63 <[email protected]> wrote:
> A common task is to identify the country of origin for an incoming IP
> address.  Seems silly for each of us to upload a country/IP database
> to GAE.  Is there already a centralized way to handle this?
>
> I saw this post (http://groups.google.com/group/google-appengine/
> browse_thread/thread/50b7042f33166aba/c5e2dfcfd4d26af5?
> lnk=gst&q=country+ip+address#c5e2dfcfd4d26af5), but it's unclear to me
> how reliable this is or whether it's being maintained.
>
> BTW, if we can get country, can we get lower level divisions (e.g.
> state/province) as well?
mutiny.appspot.com does it with gears. geoip maxmind also can get
lat / lon lookups accurate  either in javascript or python.
And there's google.loader.ClientLocation accordingly
    * ClientLocation.latitude — supplies the low resolution latitude
associated with the client's IP address
    * ClientLocation.longitude — supplies the low resolution longitude
associated with the client's IP address
    * ClientLocation.address.city — supplies the name of the city
associated with the client's IP address
    * ClientLocation.address.country — supplies the name of the
country associated with the client's IP address
    * ClientLocation.address.country_code — supplies the name of the
ISO 3166-1 country code associated with the client's IP address
    * ClientLocation.address.region — supplies the country specific
region name associated with the client's IP address
http://code.google.com/apis/ajax/documentation/#ClientLocation
http://googlegeodevelopers.blogspot.com/2008/08/load-your-users-location-on-map.html
or maxmind geoip or serverside wtanaka I use like this
        def getGeoIPCode(ipaddr):
            from google.appengine.api import memcache
            memcache_key = "gip_%s" % ipaddr
            data = memcache.get(memcache_key)
            if data is not None:
                return data
            geoipcode = ''
            from google.appengine.api import urlfetch
            try:
                fetch_response = urlfetch.fetch('http://
geoip.wtanaka.com/cc/%s' % ipaddr)
                if fetch_response.status_code == 200:
                    geoipcode = fetch_response.content
            except urlfetch.Error, e:
                pass
            if geoipcode:
                memcache.set(memcache_key, geoipcode)
            return geoipcode
Above returns countrycode ie br (brazil) in (india) ch (china) etc. I
have a demo that should zoom your location and display location
(www.koolbusiness.com/ai)
Good luck and thanks for more advice on improving this geography.

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.


Reply via email to