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

Resolved chanify:// naming confusion #1266

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion KEYWORDS
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ AWS
BulkSMS
BulkVS
Burst SMS
Chantify
Chanify
Chat
CLI
ClickSend
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The table below identifies the services this tool supports and some example serv
| [Apprise API](https://github.com/caronc/apprise/wiki/Notify_apprise_api) | apprise:// or apprises:// | (TCP) 80 or 443 | apprise://hostname/Token
| [AWS SES](https://github.com/caronc/apprise/wiki/Notify_ses) | ses:// | (TCP) 443 | ses://user@domain/AccessKeyID/AccessSecretKey/RegionName<br/>ses://user@domain/AccessKeyID/AccessSecretKey/RegionName/email1/email2/emailN
| [Bark](https://github.com/caronc/apprise/wiki/Notify_bark) | bark:// | (TCP) 80 or 443 | bark://hostname<br />bark://hostname/device_key<br />bark://hostname/device_key1/device_key2/device_keyN<br/>barks://hostname<br />barks://hostname/device_key<br />barks://hostname/device_key1/device_key2/device_keyN
| [Chantify](https://github.com/caronc/apprise/wiki/Notify_chantify) | chantify:// | (TCP) 443 | chantify://token
| [Chanify](https://github.com/caronc/apprise/wiki/Notify_chanify) | chantify:// | (TCP) 443 | chantify://token
| [Discord](https://github.com/caronc/apprise/wiki/Notify_discord) | discord:// | (TCP) 443 | discord://webhook_id/webhook_token<br />discord://avatar@webhook_id/webhook_token
| [Emby](https://github.com/caronc/apprise/wiki/Notify_emby) | emby:// or embys:// | (TCP) 8096 | emby://user@hostname/<br />emby://user:password@hostname
| [Enigma2](https://github.com/caronc/apprise/wiki/Notify_enigma2) | enigma2:// or enigma2s:// | (TCP) 80 or 443 | enigma2://hostname
Expand Down
34 changes: 17 additions & 17 deletions apprise/plugins/chantify.py → apprise/plugins/chanify.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

# Chantify
# Chanify
# 1. Visit https://chanify.net/

# The API URL will look something like this:
Expand All @@ -41,22 +41,22 @@
from ..locale import gettext_lazy as _


class NotifyChantify(NotifyBase):
class NotifyChanify(NotifyBase):
"""
A wrapper for Chantify Notifications
A wrapper for Chanify Notifications
"""

# The default descriptive name associated with the Notification
service_name = _('Chantify')
service_name = _('Chanify')

# The services URL
service_url = 'https://chanify.net/'

# The default secure protocol
secure_protocol = 'chantify'
secure_protocol = 'chanify'

# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_chantify'
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_chanify'

# Notification URL
notify_url = 'https://api.chanify.net/v1/sender/{token}/'
Expand Down Expand Up @@ -91,14 +91,14 @@ class NotifyChantify(NotifyBase):

def __init__(self, token, **kwargs):
"""
Initialize Chantify Object
Initialize Chanify Object
"""
super().__init__(**kwargs)

self.token = validate_regex(
token, *self.template_tokens['token']['regex'])
if not self.token:
msg = 'The Chantify token specified ({}) is invalid.'\
msg = 'The Chanify token specified ({}) is invalid.'\
.format(token)
self.logger.warning(msg)
raise TypeError(msg)
Expand All @@ -121,9 +121,9 @@ def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs):
'text': body
}

self.logger.debug('Chantify GET URL: %s (cert_verify=%r)' % (
self.logger.debug('Chanify GET URL: %s (cert_verify=%r)' % (
self.notify_url, self.verify_certificate))
self.logger.debug('Chantify Payload: %s' % str(payload))
self.logger.debug('Chanify Payload: %s' % str(payload))

# Always call throttle before any remote server i/o is made
self.throttle()
Expand All @@ -139,10 +139,10 @@ def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs):
if r.status_code != requests.codes.ok:
# We had a problem
status_str = \
NotifyChantify.http_response_code_lookup(r.status_code)
NotifyChanify.http_response_code_lookup(r.status_code)

self.logger.warning(
'Failed to send Chantify notification: '
'Failed to send Chanify notification: '
'{}{}error={}.'.format(
status_str,
', ' if status_str else '',
Expand All @@ -154,11 +154,11 @@ def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs):
return False

else:
self.logger.info('Sent Chantify notification.')
self.logger.info('Sent Chanify notification.')

except requests.RequestException as e:
self.logger.warning(
'A Connection error occurred sending Chantify '
'A Connection error occurred sending Chanify '
'notification.')
self.logger.debug('Socket Exception: %s' % str(e))

Expand All @@ -178,7 +178,7 @@ def url(self, privacy=False, *args, **kwargs):
return '{schema}://{token}/?{params}'.format(
schema=self.secure_protocol,
token=self.pprint(self.token, privacy, safe=''),
params=NotifyChantify.urlencode(params),
params=NotifyChanify.urlencode(params),
)

@property
Expand Down Expand Up @@ -207,9 +207,9 @@ def parse_url(url):

# Allow over-ride
if 'token' in results['qsd'] and len(results['qsd']['token']):
results['token'] = NotifyChantify.unquote(results['qsd']['token'])
results['token'] = NotifyChanify.unquote(results['qsd']['token'])

else:
results['token'] = NotifyChantify.unquote(results['host'])
results['token'] = NotifyChanify.unquote(results['host'])

return results
2 changes: 1 addition & 1 deletion packaging/redhat/python-apprise.spec
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ notification services that are out there. Apprise opens the door and makes
it easy to access:

Africas Talking, Apprise API, APRS, AWS SES, AWS SNS, Bark, Burst SMS,
BulkSMS, BulkVS, Chantify, ClickSend, DAPNET, DingTalk, Discord, E-Mail, Emby,
BulkSMS, BulkVS, Chanify, ClickSend, DAPNET, DingTalk, Discord, E-Mail, Emby,
FCM, Feishu, Flock, Free Mobile, Google Chat, Gotify, Growl, Guilded, Home
Assistant, httpSMS, IFTTT, Join, Kavenegar, KODI, Kumulos, LaMetric, Line,
LunaSea, MacOSX, Mailgun, Mastodon, Mattermost,Matrix, MessageBird, Microsoft
Expand Down
32 changes: 16 additions & 16 deletions test/test_plugin_chantify.py → test/test_plugin_chanify.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import requests

from apprise.plugins.chantify import NotifyChantify
from apprise.plugins.chanify import NotifyChanify
from helpers import AppriseURLTester

# Disable logging for a cleaner testing output
Expand All @@ -37,47 +37,47 @@

# Our Testing URLs
apprise_url_tests = (
('chantify://', {
('chanify://', {
'instance': TypeError,
}),
('chantify://:@/', {
('chanify://:@/', {
'instance': TypeError,
}),
('chantify://%badtoken%', {
('chanify://%badtoken%', {
'instance': TypeError,
}),
('chantify://abc123', {
('chanify://abc123', {
# Test token
'instance': NotifyChantify,
'instance': NotifyChanify,
}),
('chantify://?token=abc123', {
('chanify://?token=abc123', {
# Test token
'instance': NotifyChantify,
'instance': NotifyChanify,
}),
('chantify://token', {
'instance': NotifyChantify,
('chanify://token', {
'instance': NotifyChanify,
# force a failure
'response': False,
'requests_response_code': requests.codes.internal_server_error,
}),
('chantify://token', {
'instance': NotifyChantify,
('chanify://token', {
'instance': NotifyChanify,
# throw a bizzare code forcing us to fail to look it up
'response': False,
'requests_response_code': 999,
}),
('chantify://token', {
'instance': NotifyChantify,
('chanify://token', {
'instance': NotifyChanify,
# Throws a series of connection and transfer exceptions when this flag
# is set and tests that we gracfully handle them
'test_requests_exceptions': True,
}),
)


def test_plugin_chantify_urls():
def test_plugin_chanify_urls():
"""
NotifyChantify() Apprise URLs
NotifyChanify() Apprise URLs

"""

Expand Down
Loading