Skip to content

andris9/GAE-IP-TO-COUNTRY

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

NB! No need to use this module anymore

Since SDK 1.5.1 you can use X-AppEngine-country request header (returns a two letter country code or ZZ for unknow locations) to retriev the country of the visitor, no need for external modules anymore.

IP to Country

IP to Country is a Google App Engine module (Python) to convert IP addresses into country names and country codes.

License

This module is provided FREE under the terms of the GENERAL PUBLIC LICENSE, June 1991

Usage

sys.path.insert(0, 'iptocountry.zip')
from iptocountry import convert as iptolocation, country as iptocountry

location = iptolocation()
country = iptocountry()

print "You are from %s (country code - %s)" % (country, location)

Updating

To update the database, upzip the PHP files from http://www.phptutorial.info/iptocountry/ip_files.zip to /src/ip_files. Then run parser.php which generates new .PY files to src/iptocountry. Zip the directory src/iptocountry to iptocountry.zip and use the file instead of the old one in your projects.

Comments

IP to Country does not use database but a collection of files to find the country for a particular IP address. Google App Engine has a limit of 1000 files per application so it is highly encouraged to ZIP all the module files into one bigger file. See build for an example.

About

Converts an IP to country name (Google App Engine module)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published