Add url format as optional argument

This commit is contained in:
Joscha 2016-05-09 22:17:16 +02:00
parent 6d24f08924
commit 4933caa6a9

View file

@ -24,12 +24,14 @@ class Connection():
- "stop" - "stop"
""" """
def __init__(self, room): def __init__(self, room, url_format=ROOM_FORMAT):
""" """
room - name of the room to connect to room - name of the room to connect to
""" """
self.room = room self.room = room
self._url = url_format.format(self.room)
self._stopping = False self._stopping = False
@ -54,7 +56,7 @@ class Connection():
while tries != 0: while tries != 0:
try: try:
self._ws = websocket.create_connection( self._ws = websocket.create_connection(
ROOM_FORMAT.format(self.room), self._url,
enable_multithread=True enable_multithread=True
) )