Skip to content

Instantly share code, notes, and snippets.

@gsathya
Last active December 28, 2015 22:39
Show Gist options
  • Save gsathya/7572995 to your computer and use it in GitHub Desktop.
Save gsathya/7572995 to your computer and use it in GitHub Desktop.
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