mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Version 2.3.8
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
@ -1 +1 @@
|
||||
__version__ = '2.3.7'
|
||||
__version__ = '2.3.8'
|
||||
|
@ -1,7 +1,6 @@
|
||||
import logging
|
||||
import requests
|
||||
import websockets
|
||||
import backoff
|
||||
|
||||
from requests.auth import HTTPBasicAuth
|
||||
import asyncio # Add asyncio for async functionality
|
||||
@ -42,9 +41,7 @@ class Client(object):
|
||||
r = requests.get("%s/%s" % (self.url, sess), auth=self.auth)
|
||||
return decode(r)
|
||||
|
||||
@backoff.on_exception(backoff.expo, requests.exceptions.ConnectionError, max_tries=10)
|
||||
async def start_websocket(self, consumer):
|
||||
async with self.websocket_semaphore:
|
||||
s = "%s/events" % self.websocket
|
||||
while True:
|
||||
try:
|
||||
@ -56,15 +53,11 @@ class Client(object):
|
||||
logging.debug("Error while parsing event (%s)", ex)
|
||||
except websockets.ConnectionClosedError:
|
||||
logging.debug("Lost websocket connection. Reconnecting...")
|
||||
await asyncio.sleep(5) # Sleep for x seconds before reconnecting
|
||||
except websockets.WebSocketException as wex:
|
||||
logging.debug("Websocket exception (%s)", wex)
|
||||
await asyncio.sleep(5) # Sleep for x seconds before reconnecting
|
||||
except Exception as e:
|
||||
logging.exception("Other error while opening websocket (%s) with parameter %s", e, s)
|
||||
await asyncio.sleep(5) # Sleep for x seconds before reconnecting
|
||||
|
||||
@backoff.on_exception(backoff.expo, requests.exceptions.ConnectionError, max_tries=10)
|
||||
def run(self, command, verbose_errors=True):
|
||||
for _ in range(0, 2):
|
||||
try:
|
||||
|
Reference in New Issue
Block a user