Last active
December 28, 2015 22:39
-
-
Save gsathya/7572995 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
from ghost import Ghost | |
import threading | |
import time | |
def read_csv(): | |
urls = [] | |
with open('test.csv', "r") as ifile: | |
for row in ifile: | |
cols = row.split(',') | |
urls.append(cols[1].rstrip()) | |
return urls | |
def update(ghost, urls): | |
start = 0 | |
while True: | |
for i in range(5): | |
page, extra_resources = ghost.open('http://' + urls[start+i]) | |
assert page.http_status==200 | |
print page.http_status | |
if start == len(results): | |
start = 0 | |
else: | |
start += 5 | |
time.sleep(1) | |
if __name__ == "__main__": | |
urls = read_csv() | |
ghost = Ghost() | |
update(ghost, urls) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment