native urls now correctly accept arguments

pull/164/head
Chris Caron 5 years ago
parent 2792d18289
commit 6787d33e6b

@ -408,7 +408,7 @@ class NotifyDiscord(NotifyBase):
r'^https?://discordapp\.com/api/webhooks/'
r'(?P<webhook_id>[0-9]+)/'
r'(?P<webhook_token>[A-Z0-9_-]+)/?'
r'(?P<args>\?[.+])?$', url, re.I)
r'(?P<args>\?.+)?$', url, re.I)
if result:
return NotifyDiscord.parse_url(

@ -363,7 +363,7 @@ class NotifyFlock(NotifyBase):
result = re.match(
r'^https?://api\.flock\.com/hooks/sendMessage/'
r'(?P<token>[a-z0-9-]{24})/?'
r'(?P<args>\?[.+])?$', url, re.I)
r'(?P<args>\?.+)?$', url, re.I)
if result:
return NotifyFlock.parse_url(

@ -356,7 +356,7 @@ class NotifyIFTTT(NotifyBase):
r'^https?://maker\.ifttt\.com/use/'
r'(?P<webhook_id>[A-Z0-9_-]+)'
r'/?(?P<events>([A-Z0-9_-]+/?)+)?'
r'/?(?P<args>\?[.+])?$', url, re.I)
r'/?(?P<args>\?.+)?$', url, re.I)
if result:
return NotifyIFTTT.parse_url(

@ -359,7 +359,7 @@ class NotifyMSTeams(NotifyBase):
r'IncomingWebhook/'
r'(?P<token_b>[A-Z0-9]+)/'
r'(?P<token_c>[A-Z0-9-]+)/?'
r'(?P<args>\?[.+])?$', url, re.I)
r'(?P<args>\?.+)?$', url, re.I)
if result:
return NotifyMSTeams.parse_url(

@ -352,7 +352,7 @@ class NotifyRyver(NotifyBase):
result = re.match(
r'^https?://(?P<org>[A-Z0-9_-]+)\.ryver\.com/application/webhook/'
r'(?P<webhook_token>[A-Z0-9]+)/?'
r'(?P<args>\?[.+])?$', url, re.I)
r'(?P<args>\?.+)?$', url, re.I)
if result:
return NotifyRyver.parse_url(

@ -460,7 +460,7 @@ class NotifySlack(NotifyBase):
r'(?P<token_a>[A-Z0-9]+)/'
r'(?P<token_b>[A-Z0-9]+)/'
r'(?P<token_c>[A-Z0-9]+)/?'
r'(?P<args>\?[.+])?$', url, re.I)
r'(?P<args>\?.+)?$', url, re.I)
if result:
return NotifySlack.parse_url(

@ -248,7 +248,7 @@ class NotifyWebexTeams(NotifyBase):
result = re.match(
r'^https?://api\.ciscospark\.com/v[1-9][0-9]*/webhooks/incoming/'
r'(?P<webhook_token>[A-Z0-9_-]+)/?'
r'(?P<args>\?[.+])?$', url, re.I)
r'(?P<args>\?.+)?$', url, re.I)
if result:
return NotifyWebexTeams.parse_url(

@ -310,6 +310,12 @@ TEST_URLS = (
'instance': plugins.NotifyDiscord,
'requests_response_code': requests.codes.no_content,
}),
('https://discordapp.com/api/webhooks/{}/{}?footer=yes'.format(
'0' * 10, 'B' * 40), {
# Native URL Support with arguments
'instance': plugins.NotifyDiscord,
'requests_response_code': requests.codes.no_content,
}),
('discord://%s/%s?format=markdown&avatar=No&footer=No' % (
'i' * 24, 't' * 64), {
'instance': plugins.NotifyDiscord,
@ -476,6 +482,11 @@ TEST_URLS = (
('https://api.flock.com/hooks/sendMessage/{}/'.format('i' * 24), {
'instance': plugins.NotifyFlock,
}),
# Native URL Support with arguments
('https://api.flock.com/hooks/sendMessage/{}/?format=markdown'.format(
'i' * 24), {
'instance': plugins.NotifyFlock,
}),
# Bot API presumed if one or more targets are specified
# Provide markdown format
('flock://%s/u:%s?format=markdown' % ('i' * 24, 'u' * 12), {
@ -687,7 +698,7 @@ TEST_URLS = (
('ifttt://WebHookID@EventID/EventID2/', {
'instance': plugins.NotifyIFTTT,
}),
# Support native URL references
# Support Native URL references
('https://maker.ifttt.com/use/WebHookID/', {
# No EventID specified
'instance': TypeError,
@ -695,6 +706,10 @@ TEST_URLS = (
('https://maker.ifttt.com/use/WebHookID/EventID/', {
'instance': plugins.NotifyIFTTT,
}),
# Native URL with arguments
('https://maker.ifttt.com/use/WebHookID/EventID/?-Value1=', {
'instance': plugins.NotifyIFTTT,
}),
# Test website connection failures
('ifttt://WebHookID@EventID', {
'instance': plugins.NotifyIFTTT,
@ -2111,6 +2126,12 @@ TEST_URLS = (
('https://apprise.ryver.com/application/webhook/ckhrjW8w672m6HG', {
'instance': plugins.NotifyRyver,
}),
# Support Native URLs with arguments
('https://apprise.ryver.com/application/webhook/ckhrjW8w672m6HG'
'?webhook=ryver',
{
'instance': plugins.NotifyRyver,
}),
('ryver://caronc@apprise/ckhrjW8w672m6HG', {
'instance': plugins.NotifyRyver,
# don't include an image by default
@ -2332,6 +2353,11 @@ TEST_URLS = (
'A' * 9, 'B' * 9, 'c' * 24), {
'instance': plugins.NotifySlack,
}),
# Native URL Support with arguments
('https://hooks.slack.com/services/{}/{}/{}?format=text'.format(
'A' * 9, 'B' * 9, 'c' * 24), {
'instance': plugins.NotifySlack,
}),
('slack://username@INVALID/A1BRTD4JD/TIiajkdnlazkcOXrIdevi7FQ/#cool', {
# invalid 1st Token
'instance': TypeError,
@ -2985,6 +3011,12 @@ TEST_URLS = (
# token provided - we're good
'instance': plugins.NotifyWebexTeams,
}),
# Support Native URLs with arguments
('https://api.ciscospark.com/v1/webhooks/incoming/{}?format=text'.format(
'a' * 80), {
# token provided - we're good
'instance': plugins.NotifyWebexTeams,
}),
('wxteams://{}'.format('a' * 80), {
'instance': plugins.NotifyWebexTeams,
# force a failure

Loading…
Cancel
Save