diff --git a/respodns/ip_info.py b/respodns/ip_info.py index dd136ca..1abab39 100644 --- a/respodns/ip_info.py +++ b/respodns/ip_info.py @@ -98,6 +98,8 @@ class IpInfoByIpApi(IpInfoBase): ) query = "\r\n".join(query_lines) + "\r\n\r\n" + # TODO: only perform DNS lookup once. + # TODO: only open connection once if possible (keep-alive). reader, writer = await open_connection(self.host, 80) writer.write(self.encode(query, "strict")) diff --git a/respodns/top1m.py b/respodns/top1m.py index 6a0db05..a1118b7 100644 --- a/respodns/top1m.py +++ b/respodns/top1m.py @@ -1,5 +1,5 @@ urltop_default = "http://s3.amazonaws.com/alexa-static/top-1m.csv.zip" -csvfn_default = "top-1m.csv" +csvfn_default = "top-1m.csv" # path within the zip file one_week = 7 * 24 * 60 * 60 # in seconds @@ -8,6 +8,7 @@ def alive(fp, expiry): from os.path import exists, getmtime, getsize from time import time + # 2 is used as a magic number because it's len("\r\n") return exists(fp) and time() < getmtime(fp) + expiry and getsize(fp) > 2