Files
OneForAll-mirror/common/ipgeo.py
T
2020-06-18 10:38:41 +08:00

12 lines
382 B
Python

import zipfile
import IP2Location
from config.setting import data_storage_dir
zip_path = data_storage_dir.joinpath("IP2LOCATION-LITE-DB3.BIN.ZIP")
bin_path = data_storage_dir.joinpath("IP2LOCATION-LITE-DB3.BIN")
if not bin_path.exists():
zf = zipfile.ZipFile(zip_path)
zf.extract('IP2LOCATION-LITE-DB3.BIN', data_storage_dir)
IpGeoInfo = IP2Location.IP2Location(bin_path)