GeoLiteCity.zip
通过ip查询国家和城市的库,需要先pip install geoip,然后把该文件的地址放到对应的位置上。 class GeoIP(object): def __init__(self, db="GeoLiteCity.dat"): self.gi = pygeoip.GeoIP(db, pygeoip.MEMORY_CACHE) def region(self, ip): res = {} info = self.gi.record_by_addr(ip) res["country"] = info["coun
下载地址
用户评论