dschep / dschep/ntfy

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

Open
#225 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
5k
Forks
216
PR merge metrics
No merged PRs in 30d

Description

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)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.