lucasheld / uptime-kuma-api

A Python wrapper for the Uptime Kuma Socket.IO API
https://uptime-kuma-api.readthedocs.io
MIT License
252 stars 19 forks source link

add "wait_timeout" to python-socketio "connect" method #11

Closed Kobidav closed 1 year ago

Kobidav commented 1 year ago

Hi @lucasheld . Thank you for the great tool. Some times i have api connection issues with error socketio.exceptions.BadNamespaceError: / is not a connected namespace. And for me helped adding wait-timeout param to python-socketio "connect" method in api.py:

#api.py:426
def connect(self):
    url = self.url.rstrip("/")
        try:
            self.sio.connect(f'{url}/socket.io/',wait_timeout=5)
        except:
            print("")

Could you please add option to manage wait-timeout from "UptimeKumaApi"?

lucasheld commented 1 year ago

Thank you very much for this suggestion. I have never noticed this problem because I only test with a local Uptime Kuma instance.

It's implemented in version 0.6.0.

You can pass this parameter when creating the UptimeKumaApi instance:

>>> api = UptimeKumaApi(url, wait_timeout=5)