import GeoIP
gi = GeoIP.open('GeoLiteCity.dat', GeoIP.GEOIP_INDEX_CACHE | GeoIP.
    GEOIP_CHECK_CACHE)
print(gi.record_by_name('74.125.67.100'))
How to detect the country and city of a user accessing your site?