fix disconnect

This commit is contained in:
Mylloon 2021-08-05 18:41:30 +02:00
parent 01ec2083dc
commit 209a30cfa1

View file

@ -52,8 +52,11 @@ class Listener(StreamListener):
def on_connect(self): def on_connect(self):
print(f"Scroll sur Twitter avec les abonnements de @{', @'.join(self.users)} comme timeline...") print(f"Scroll sur Twitter avec les abonnements de @{', @'.join(self.users)} comme timeline...")
def on_disconnect(self, notice): def on_disconnect(notice):
print(f"Déconnexion ({notice['code']}). Raison : {notice['reason']}") notice = notice["disconnect"]
print(f"Déconnexion (code {notice['code']}).", end = " ")
if len(notice['reason']) > 0:
print(f"Raison : {notice['reason']}")
def on_status(self, status): def on_status(self, status):
if status._json["user"]["id"] in self.listOfFriendsID: # verification of the author of the tweet if status._json["user"]["id"] in self.listOfFriendsID: # verification of the author of the tweet