ssl_verify argument not used in get_status_page() #65

Open
opened 2024-02-21 23:03:43 +01:00 by jmcmillan89 · 0 comments
jmcmillan89 commented 2024-02-21 23:03:43 +01:00 (Migrated from github.com)

When instantiating an instance of the UptimeKumaApi class, you can disable SSL verification via the ssl_verify argument in the constructor:

def __init__(
    self,
    url: str,
    timeout: float = 10,
    headers: dict = None,
    ssl_verify: bool = True,
    wait_events: float = 0.2
 ) -> None:

This is then set on the Client: self.sio = socketio.Client(ssl_verify=ssl_verify) so any web requests issued by the Client use this variable.

However, there is a single requests.get() within get_status_page() that bypasses the Client, so the ssl_verify arg is not passed:

try:
    r2 = requests.get(f"{self.url}/api/status-page/{slug}", timeout=self.timeout).json()
except requests.exceptions.Timeout as e:
    raise Timeout(e)

As a result, if you instantiate your API with api = UptimeKumaApi("https://localhost:8080", ssl_verify=False), calling api.get_status_page() will fail with an SSL verification error.

When instantiating an instance of the `UptimeKumaApi` class, you can disable SSL verification via the `ssl_verify` argument in the constructor: ```python def __init__( self, url: str, timeout: float = 10, headers: dict = None, ssl_verify: bool = True, wait_events: float = 0.2 ) -> None: ``` This is then set on the Client: `self.sio = socketio.Client(ssl_verify=ssl_verify)` so any web requests issued by the Client use this variable. However, there is a single `requests.get()` within `get_status_page()` that bypasses the Client, so the `ssl_verify` arg is not passed: ```python try: r2 = requests.get(f"{self.url}/api/status-page/{slug}", timeout=self.timeout).json() except requests.exceptions.Timeout as e: raise Timeout(e) ``` As a result, if you instantiate your API with `api = UptimeKumaApi("https://localhost:8080", ssl_verify=False)`, calling `api.get_status_page()` will fail with an SSL verification error.
Sign in to join this conversation.
No description provided.