Skip to content

pushover priority 2 (emergency) is broken if you provide required expiry or retry #225

@shanness

Description

@shanness

This is because unlike priority which is converted to an int
priority = int(priority)

causing

    if not expire or expire > 86400:
TypeError: '>' not supported between instances of 'str' and 'int'

retry and expiry aren't. This fixes it (wrapping all int comparisons and the final data set in int(..)

            if not retry or int(retry) < 30:
                logging.getLogger(__name__).error(
                    'retry is less than 30 or is not set, '
                    'setting retry to 30 to comply with '
                    'pushover API requirements')
                data['retry'] = 30
            else:
                data['retry'] = int(retry)

            # Expire can not be more than 86400 (24 hours)
            if not expire or int(expire) > 86400:
                logging.getLogger(__name__).error(
                    'expire is greater than 86400 seconds or is not set,'
                    'setting expire to 86400 to comply with'
                    'pushover API requirements')
                data['expire'] = 86400
            elif int(expire) <= 86400:
                data['expire'] = int(expire)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions