From 27ee8c1081854309cec3d31dd40fdcdd2652e70f Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Wed, 9 Jun 2021 10:58:45 +0200 Subject: [PATCH] add a few comments --- respodns/ip_info.py | 2 ++ respodns/top1m.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) 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