How can you detect the country of origin of the users accessing your site?
I\'m using Google Analytics on my site and can see that I have users coming from different re
Max mind costs money. For a free yet country code only solution you can try: https://pypi.python.org/pypi/geoip2nation/
pip install geoip2nation
from geoip import geoip
r = geoip.GeoIp()
r.load_memory()
r.resolve("12.12.12.12").country_code
#This prints : 'US'
print r.resolve("123.44.57.4")
#This prints : {'country': 'Korea (South)', 'host_name': '', 'country_code': 'KR'}
r.resolve2("12.12.12.12")
#This prints : 'US'