MCPcopy Create free account
hub / github.com/qiyeboy/IPProxyPool / dump

Method dump

test/testIPAddress.py:66–77  ·  view source on GitHub ↗
(self, first, last)

Source from the content-addressed store, hash-verified

64 return countryAddr + " " + areaAddr
65
66 def dump(self, first, last):
67 if last > self.indexCount:
68 last = self.indexCount
69 for index in range(first, last):
70 offset = self.firstIndex + index * 7
71 self.ipdb.seek(offset)
72 buf = self.ipdb.read(7)
73 (ip, of1, of2) = struct.unpack("IHB", buf)
74 address = self.getAddr(of1 + (of2 << 16))
75 # 把GBK转为utf-8
76 address = str(address, 'gbk').encode("utf-8")
77 logger.info("%d %s %s" % (index, self.ip2str(ip), address))
78
79 def setIpRange(self, index):
80 offset = self.firstIndex + index * 7

Callers

nothing calls this directly

Calls 2

getAddrMethod · 0.95
ip2strMethod · 0.95

Tested by

no test coverage detected