diff options
Diffstat (limited to 'omegle.py')
-rw-r--r-- | omegle.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -33,7 +33,7 @@ class OmegleChat(object): "Accept": "application/json" } - def __init__(self,poll_interval=0.5): + def __init__(self,name="",poll_interval=0.5): self.conn = httplib.HTTPConnection('www.omegle.com') # self.conn.set_debuglevel(1) @@ -41,7 +41,7 @@ class OmegleChat(object): self.timer = Timer(self.events, poll_interval) - self.logger = logging.getLogger(__name__ + "." + self.__class__.__name__) + self.logger = logging.getLogger(__name__ + "." + self.__class__.__name__ + name) self.is_connected = False def start(self): @@ -62,6 +62,7 @@ class OmegleChat(object): def disconnect(self): self.logger.debug("/disconnect") + self.is_connected = False self.timer.stop() self.conn_lock.acquire() self.conn.request("POST", @@ -73,8 +74,9 @@ class OmegleChat(object): body = r.read() self.logger.debug("/disconnect sent. Read: %s" % body) if body == "win": - self.is_connected = False + pass else: + self.is_connected = True #disconnect failed raise Exception("/disconnect; Bad response: %s" % body) def events(self): |