Skip to content

Instantly share code, notes, and snippets.

@rcoh
Created May 5, 2017 22:42
Show Gist options
  • Save rcoh/d8c119441f0b2789a36cc3368e1273c0 to your computer and use it in GitHub Desktop.
Save rcoh/d8c119441f0b2789a36cc3368e1273c0 to your computer and use it in GitHub Desktop.
from threading import Thread
from ghost import Ghost
ghost = Ghost()
def make_ghost_request():
while True:
with ghost.start() as sess:
sess.open('http://www.reddit.com')
sess.wait_for_page_loaded()
def start_task_thread():
t = Thread(target=make_ghost_request)
t.daemon = True
t.start()
THREAD_COUNT = 4
for i in range(THREAD_COUNT):
start_task_thread()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment