def get_geoip_dat ():
    """Find a GeoIP database, preferring city over country lookup."""
    datafiles = ("GeoIPCity.dat", "GeoIP.dat")
    if os.name == 'nt':
        paths = (sys.exec_prefix, r"c:\geoip")
    else:
        paths = ("/usr/local/share/GeoIP", "/usr/share/GeoIP")
    for path in paths:
        for datafile in datafiles:
            filename = os.path.join(path, datafile)
            if os.path.isfile(filename):
                return filename
def get_geoip_dat ( ) : datafiles = ( "GeoIPCity.dat" , "GeoIP.dat" ) if os . name == 'nt' : paths = ( sys . exec_prefix , r"c:\geoip" ) else : paths = ( "/usr/local/share/GeoIP" , "/usr/share/GeoIP" ) for path in paths : for datafile in datafiles : filename = os . path . join ( path , datafile ) if os . path . isfile ( filename ) : return filename
Find a GeoIP database, preferring city over country lookup.