add a few comments

This commit is contained in:
Connor Olding 2021-06-09 10:58:45 +02:00
parent 24c24f4690
commit 27ee8c1081
2 changed files with 4 additions and 1 deletions

View File

@ -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"))

View File

@ -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