python pip install geoip python DATABASE_PATH = "/path/to/GeoLite2-City.mmdb" python from geoip import geolite2 geoip_database = geolite2.reader() python ip_address = "123.123.123.123" match = geoip_database.get(ip_address) if match is not None: country = match.get("country") city = match.get("city") latitude = match.get("latitude") longitude = match.get("longitude") python geolite2.close()


上一篇:
下一篇:
切换中文