Skip to content

Instantly share code, notes, and snippets.

@tcarrio
Last active December 21, 2015 15:38
Show Gist options
  • Save tcarrio/d0fff6d220e0b8ab5896 to your computer and use it in GitHub Desktop.
Save tcarrio/d0fff6d220e0b8ab5896 to your computer and use it in GitHub Desktop.
Clarifying python __init__ and main
from selenium import webdriver
from collections import deque
import threading
class AccountManager():
def __init__(self):
self.login = []
self.emails= []
self.log = deque([])
self.IWT=5
self.browser=webdriver.FireFox()
def log_listener(self):
while(self.active):
if len(self.log)>0:
print(self.log.popleft())
def start_log(self):
self.active=1
t = threading.Thread(target=self.log_listener)
t.start()
def start_manager(self):
self.browser.get('http://www.google.com')
self.log.append('Loaded Google')
self.active=0
self.browser.quit()
if __name__=="__main__":
wga = AccountManger()
wga.start_log()
wga.start_manager()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment