lucasheld / uptime-kuma-api

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

fix type for notificationIDList in _build_monitor_data() #57

Open obfusk opened 1 year ago

obfusk commented 1 year ago

The type here is incorrect. In _build_monitor_data(), the notificationIDList parameter is a list, which then gets converted to a dict in _convert_monitor_input().

The wrong type here doesn't actually affect anything as it is an empty dict and thus never processed in _convert_monitor_input(), as an empty list would have been as well.

    dict_notification_ids = {}
    if kwargs["notificationIDList"]:
        for notification_id in kwargs["notificationIDList"]:
            dict_notification_ids[notification_id] = True
    kwargs["notificationIDList"] = dict_notification_ids

But it's still technically the wrong type in that part of the code, and changing other parts of the code could result in that causing a bug at some point.

NB: I haven't tested this change yet.