Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shanness opened this issue Apr 5, 2021 · 0 comments

Comments

@shanness
Copy link

shanness commented Apr 5, 2021

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant