mirror of https://github.com/caronc/apprise
native urls now correctly accept arguments
parent
2792d18289
commit
6787d33e6b
|
@ -408,7 +408,7 @@ class NotifyDiscord(NotifyBase):
|
||||||
r'^https?://discordapp\.com/api/webhooks/'
|
r'^https?://discordapp\.com/api/webhooks/'
|
||||||
r'(?P<webhook_id>[0-9]+)/'
|
r'(?P<webhook_id>[0-9]+)/'
|
||||||
r'(?P<webhook_token>[A-Z0-9_-]+)/?'
|
r'(?P<webhook_token>[A-Z0-9_-]+)/?'
|
||||||
r'(?P<args>\?[.+])?$', url, re.I)
|
r'(?P<args>\?.+)?$', url, re.I)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return NotifyDiscord.parse_url(
|
return NotifyDiscord.parse_url(
|
||||||
|
|
|
@ -363,7 +363,7 @@ class NotifyFlock(NotifyBase):
|
||||||
result = re.match(
|
result = re.match(
|
||||||
r'^https?://api\.flock\.com/hooks/sendMessage/'
|
r'^https?://api\.flock\.com/hooks/sendMessage/'
|
||||||
r'(?P<token>[a-z0-9-]{24})/?'
|
r'(?P<token>[a-z0-9-]{24})/?'
|
||||||
r'(?P<args>\?[.+])?$', url, re.I)
|
r'(?P<args>\?.+)?$', url, re.I)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return NotifyFlock.parse_url(
|
return NotifyFlock.parse_url(
|
||||||
|
|
|
@ -356,7 +356,7 @@ class NotifyIFTTT(NotifyBase):
|
||||||
r'^https?://maker\.ifttt\.com/use/'
|
r'^https?://maker\.ifttt\.com/use/'
|
||||||
r'(?P<webhook_id>[A-Z0-9_-]+)'
|
r'(?P<webhook_id>[A-Z0-9_-]+)'
|
||||||
r'/?(?P<events>([A-Z0-9_-]+/?)+)?'
|
r'/?(?P<events>([A-Z0-9_-]+/?)+)?'
|
||||||
r'/?(?P<args>\?[.+])?$', url, re.I)
|
r'/?(?P<args>\?.+)?$', url, re.I)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return NotifyIFTTT.parse_url(
|
return NotifyIFTTT.parse_url(
|
||||||
|
|
|
@ -359,7 +359,7 @@ class NotifyMSTeams(NotifyBase):
|
||||||
r'IncomingWebhook/'
|
r'IncomingWebhook/'
|
||||||
r'(?P<token_b>[A-Z0-9]+)/'
|
r'(?P<token_b>[A-Z0-9]+)/'
|
||||||
r'(?P<token_c>[A-Z0-9-]+)/?'
|
r'(?P<token_c>[A-Z0-9-]+)/?'
|
||||||
r'(?P<args>\?[.+])?$', url, re.I)
|
r'(?P<args>\?.+)?$', url, re.I)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return NotifyMSTeams.parse_url(
|
return NotifyMSTeams.parse_url(
|
||||||
|
|
|
@ -352,7 +352,7 @@ class NotifyRyver(NotifyBase):
|
||||||
result = re.match(
|
result = re.match(
|
||||||
r'^https?://(?P<org>[A-Z0-9_-]+)\.ryver\.com/application/webhook/'
|
r'^https?://(?P<org>[A-Z0-9_-]+)\.ryver\.com/application/webhook/'
|
||||||
r'(?P<webhook_token>[A-Z0-9]+)/?'
|
r'(?P<webhook_token>[A-Z0-9]+)/?'
|
||||||
r'(?P<args>\?[.+])?$', url, re.I)
|
r'(?P<args>\?.+)?$', url, re.I)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return NotifyRyver.parse_url(
|
return NotifyRyver.parse_url(
|
||||||
|
|
|
@ -460,7 +460,7 @@ class NotifySlack(NotifyBase):
|
||||||
r'(?P<token_a>[A-Z0-9]+)/'
|
r'(?P<token_a>[A-Z0-9]+)/'
|
||||||
r'(?P<token_b>[A-Z0-9]+)/'
|
r'(?P<token_b>[A-Z0-9]+)/'
|
||||||
r'(?P<token_c>[A-Z0-9]+)/?'
|
r'(?P<token_c>[A-Z0-9]+)/?'
|
||||||
r'(?P<args>\?[.+])?$', url, re.I)
|
r'(?P<args>\?.+)?$', url, re.I)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return NotifySlack.parse_url(
|
return NotifySlack.parse_url(
|
||||||
|
|
|
@ -248,7 +248,7 @@ class NotifyWebexTeams(NotifyBase):
|
||||||
result = re.match(
|
result = re.match(
|
||||||
r'^https?://api\.ciscospark\.com/v[1-9][0-9]*/webhooks/incoming/'
|
r'^https?://api\.ciscospark\.com/v[1-9][0-9]*/webhooks/incoming/'
|
||||||
r'(?P<webhook_token>[A-Z0-9_-]+)/?'
|
r'(?P<webhook_token>[A-Z0-9_-]+)/?'
|
||||||
r'(?P<args>\?[.+])?$', url, re.I)
|
r'(?P<args>\?.+)?$', url, re.I)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return NotifyWebexTeams.parse_url(
|
return NotifyWebexTeams.parse_url(
|
||||||
|
|
|
@ -310,6 +310,12 @@ TEST_URLS = (
|
||||||
'instance': plugins.NotifyDiscord,
|
'instance': plugins.NotifyDiscord,
|
||||||
'requests_response_code': requests.codes.no_content,
|
'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' % (
|
('discord://%s/%s?format=markdown&avatar=No&footer=No' % (
|
||||||
'i' * 24, 't' * 64), {
|
'i' * 24, 't' * 64), {
|
||||||
'instance': plugins.NotifyDiscord,
|
'instance': plugins.NotifyDiscord,
|
||||||
|
@ -476,6 +482,11 @@ TEST_URLS = (
|
||||||
('https://api.flock.com/hooks/sendMessage/{}/'.format('i' * 24), {
|
('https://api.flock.com/hooks/sendMessage/{}/'.format('i' * 24), {
|
||||||
'instance': plugins.NotifyFlock,
|
'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
|
# Bot API presumed if one or more targets are specified
|
||||||
# Provide markdown format
|
# Provide markdown format
|
||||||
('flock://%s/u:%s?format=markdown' % ('i' * 24, 'u' * 12), {
|
('flock://%s/u:%s?format=markdown' % ('i' * 24, 'u' * 12), {
|
||||||
|
@ -687,7 +698,7 @@ TEST_URLS = (
|
||||||
('ifttt://WebHookID@EventID/EventID2/', {
|
('ifttt://WebHookID@EventID/EventID2/', {
|
||||||
'instance': plugins.NotifyIFTTT,
|
'instance': plugins.NotifyIFTTT,
|
||||||
}),
|
}),
|
||||||
# Support native URL references
|
# Support Native URL references
|
||||||
('https://maker.ifttt.com/use/WebHookID/', {
|
('https://maker.ifttt.com/use/WebHookID/', {
|
||||||
# No EventID specified
|
# No EventID specified
|
||||||
'instance': TypeError,
|
'instance': TypeError,
|
||||||
|
@ -695,6 +706,10 @@ TEST_URLS = (
|
||||||
('https://maker.ifttt.com/use/WebHookID/EventID/', {
|
('https://maker.ifttt.com/use/WebHookID/EventID/', {
|
||||||
'instance': plugins.NotifyIFTTT,
|
'instance': plugins.NotifyIFTTT,
|
||||||
}),
|
}),
|
||||||
|
# Native URL with arguments
|
||||||
|
('https://maker.ifttt.com/use/WebHookID/EventID/?-Value1=', {
|
||||||
|
'instance': plugins.NotifyIFTTT,
|
||||||
|
}),
|
||||||
# Test website connection failures
|
# Test website connection failures
|
||||||
('ifttt://WebHookID@EventID', {
|
('ifttt://WebHookID@EventID', {
|
||||||
'instance': plugins.NotifyIFTTT,
|
'instance': plugins.NotifyIFTTT,
|
||||||
|
@ -2111,6 +2126,12 @@ TEST_URLS = (
|
||||||
('https://apprise.ryver.com/application/webhook/ckhrjW8w672m6HG', {
|
('https://apprise.ryver.com/application/webhook/ckhrjW8w672m6HG', {
|
||||||
'instance': plugins.NotifyRyver,
|
'instance': plugins.NotifyRyver,
|
||||||
}),
|
}),
|
||||||
|
# Support Native URLs with arguments
|
||||||
|
('https://apprise.ryver.com/application/webhook/ckhrjW8w672m6HG'
|
||||||
|
'?webhook=ryver',
|
||||||
|
{
|
||||||
|
'instance': plugins.NotifyRyver,
|
||||||
|
}),
|
||||||
('ryver://caronc@apprise/ckhrjW8w672m6HG', {
|
('ryver://caronc@apprise/ckhrjW8w672m6HG', {
|
||||||
'instance': plugins.NotifyRyver,
|
'instance': plugins.NotifyRyver,
|
||||||
# don't include an image by default
|
# don't include an image by default
|
||||||
|
@ -2332,6 +2353,11 @@ TEST_URLS = (
|
||||||
'A' * 9, 'B' * 9, 'c' * 24), {
|
'A' * 9, 'B' * 9, 'c' * 24), {
|
||||||
'instance': plugins.NotifySlack,
|
'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', {
|
('slack://username@INVALID/A1BRTD4JD/TIiajkdnlazkcOXrIdevi7FQ/#cool', {
|
||||||
# invalid 1st Token
|
# invalid 1st Token
|
||||||
'instance': TypeError,
|
'instance': TypeError,
|
||||||
|
@ -2985,6 +3011,12 @@ TEST_URLS = (
|
||||||
# token provided - we're good
|
# token provided - we're good
|
||||||
'instance': plugins.NotifyWebexTeams,
|
'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), {
|
('wxteams://{}'.format('a' * 80), {
|
||||||
'instance': plugins.NotifyWebexTeams,
|
'instance': plugins.NotifyWebexTeams,
|
||||||
# force a failure
|
# force a failure
|
||||||
|
|
Loading…
Reference in New Issue