mirror of https://github.com/caronc/apprise
better use of nexmo time-to-live default value
parent
a29764c647
commit
5c746d0b03
|
@ -70,15 +70,6 @@ class NotifyNexmo(NotifyBase):
|
||||||
# cause any title (if defined) to get placed into the message body.
|
# cause any title (if defined) to get placed into the message body.
|
||||||
title_maxlen = 0
|
title_maxlen = 0
|
||||||
|
|
||||||
# Default Time To Live
|
|
||||||
# By default Nexmo attempt delivery for 72 hours, however the maximum
|
|
||||||
# effective value depends on the operator and is typically 24 - 48 hours.
|
|
||||||
# We recommend this value should be kept at its default or at least 30
|
|
||||||
# minutes.
|
|
||||||
default_ttl = 900000
|
|
||||||
ttl_max = 604800000
|
|
||||||
ttl_min = 20000
|
|
||||||
|
|
||||||
# Define object templates
|
# Define object templates
|
||||||
templates = (
|
templates = (
|
||||||
'{schema}://{apikey}:{secret}@{from_phone}',
|
'{schema}://{apikey}:{secret}@{from_phone}',
|
||||||
|
@ -135,6 +126,12 @@ class NotifyNexmo(NotifyBase):
|
||||||
'secret': {
|
'secret': {
|
||||||
'alias_of': 'secret',
|
'alias_of': 'secret',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# Default Time To Live
|
||||||
|
# By default Nexmo attempt delivery for 72 hours, however the maximum
|
||||||
|
# effective value depends on the operator and is typically 24 - 48
|
||||||
|
# hours. We recommend this value should be kept at its default or at
|
||||||
|
# least 30 minutes.
|
||||||
'ttl': {
|
'ttl': {
|
||||||
'name': _('ttl'),
|
'name': _('ttl'),
|
||||||
'type': 'int',
|
'type': 'int',
|
||||||
|
@ -170,7 +167,7 @@ class NotifyNexmo(NotifyBase):
|
||||||
raise TypeError(msg)
|
raise TypeError(msg)
|
||||||
|
|
||||||
# Set our Time to Live Flag
|
# Set our Time to Live Flag
|
||||||
self.ttl = self.default_ttl
|
self.ttl = self.template_args['ttl']['default']
|
||||||
try:
|
try:
|
||||||
self.ttl = int(ttl)
|
self.ttl = int(ttl)
|
||||||
|
|
||||||
|
@ -178,7 +175,8 @@ class NotifyNexmo(NotifyBase):
|
||||||
# Do nothing
|
# Do nothing
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if self.ttl < self.ttl_min or self.ttl > self.ttl_max:
|
if self.ttl < self.template_args['ttl']['min'] or \
|
||||||
|
self.ttl > self.template_args['ttl']['max']:
|
||||||
msg = 'The Nexmo TTL specified ({}) is out of range.'\
|
msg = 'The Nexmo TTL specified ({}) is out of range.'\
|
||||||
.format(self.ttl)
|
.format(self.ttl)
|
||||||
self.logger.warning(msg)
|
self.logger.warning(msg)
|
||||||
|
|
Loading…
Reference in New Issue