use db-ip mmdb

This commit is contained in:
j 2020-02-02 15:31:32 +01:00
parent 66f9a51769
commit 6b82d7bbf7

View file

@ -397,8 +397,9 @@ def update_geoip(force=False):
path = os.path.join(settings.GEOIP_PATH, 'GeoLite2-City.mmdb') path = os.path.join(settings.GEOIP_PATH, 'GeoLite2-City.mmdb')
if not os.path.exists(path) or force: if not os.path.exists(path) or force:
url = 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz' url = 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz'
url = 'https://download.db-ip.com/free/dbip-city-lite-2020-01.mmdb.gz'
print('download', url) print('download', url)
ox.net.save_url(url, "%s.gz"%path) ox.net.save_url(url, "%s.gz" % path)
if os.path.exists(path): if os.path.exists(path):
os.unlink(path) os.unlink(path)
os.system('gunzip "%s.gz"' % path) os.system('gunzip "%s.gz"' % path)