fix the ProtocolError exceptions
This commit is contained in:
parent
1495f24ab2
commit
1997612350
1 changed files with 8 additions and 1 deletions
9
main.py
9
main.py
|
@ -5,6 +5,7 @@ from re import sub
|
||||||
from random import choice
|
from random import choice
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pytz import timezone
|
from pytz import timezone
|
||||||
|
from queue import Queue
|
||||||
|
|
||||||
def load(variables) -> dict:
|
def load(variables) -> dict:
|
||||||
"""Load environment variables."""
|
"""Load environment variables."""
|
||||||
|
@ -22,8 +23,9 @@ def load(variables) -> dict:
|
||||||
return keys
|
return keys
|
||||||
|
|
||||||
class Listener(StreamListener):
|
class Listener(StreamListener):
|
||||||
def __init__(self, api = None, users = None):
|
def __init__(self, api = None, users = None, q = Queue()):
|
||||||
super(Listener, self).__init__()
|
super(Listener, self).__init__()
|
||||||
|
self.q = q
|
||||||
self.api = api
|
self.api = api
|
||||||
self.listOfFriendsID = getFriendsID(api, users)
|
self.listOfFriendsID = getFriendsID(api, users)
|
||||||
|
|
||||||
|
@ -49,6 +51,11 @@ class Listener(StreamListener):
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(f"{errorMessage} {error}")
|
print(f"{errorMessage} {error}")
|
||||||
|
|
||||||
|
def do_stuff(self):
|
||||||
|
while True:
|
||||||
|
self.q.get()
|
||||||
|
self.q.task_done()
|
||||||
|
|
||||||
def getFriendsID(api, users: list) -> list:
|
def getFriendsID(api, users: list) -> list:
|
||||||
"""Get all friends of choosen users."""
|
"""Get all friends of choosen users."""
|
||||||
liste = []
|
liste = []
|
||||||
|
|
Reference in a new issue