Write the alexa top1M zip file after download
parent
b856e9897c
commit
4075a58165
|
@ -10,6 +10,9 @@ alexa_url = "http://s3.amazonaws.com/alexa-static/top-1m.csv.zip"
|
|||
alexa_file = "top-1m.csv.zip"
|
||||
user_agent = {"User-agent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0"}
|
||||
r = requests.get(alexa_url, headers=user_agent)
|
||||
with open(alexa_file, 'wb') as fd:
|
||||
for chunk in r.iter_content(4096):
|
||||
fd.write(chunk)
|
||||
with zipfile.ZipFile(alexa_file, 'r') as alexa_lists:
|
||||
for name in alexa_lists.namelist():
|
||||
if name == "top-1m.csv":
|
||||
|
|
Loading…
Reference in New Issue