mirror of https://github.com/caronc/apprise
Merge pull request #61 from caronc/46-pjet-selfhost-support-only
Updated pjet:// docs+url - online service unavailable - refs #46pull/62/head^2
commit
0159d13d48
|
@ -45,9 +45,8 @@ The table below identifies the services this tool supports and some example serv
|
||||||
| [Prowl](https://github.com/caronc/apprise/wiki/Notify_prowl) | prowl:// | (TCP) 443 | prowl://apikey<br />prowl://apikey/providerkey
|
| [Prowl](https://github.com/caronc/apprise/wiki/Notify_prowl) | prowl:// | (TCP) 443 | prowl://apikey<br />prowl://apikey/providerkey
|
||||||
| [Pushalot](https://github.com/caronc/apprise/wiki/Notify_pushalot) | palot:// | (TCP) 443 | palot://authorizationtoken
|
| [Pushalot](https://github.com/caronc/apprise/wiki/Notify_pushalot) | palot:// | (TCP) 443 | palot://authorizationtoken
|
||||||
| [PushBullet](https://github.com/caronc/apprise/wiki/Notify_pushbullet) | pbul:// | (TCP) 443 | pbul://accesstoken<br />pbul://accesstoken/#channel<br/>pbul://accesstoken/A_DEVICE_ID<br />pbul://accesstoken/email@address.com<br />pbul://accesstoken/#channel/#channel2/email@address.net/DEVICE
|
| [PushBullet](https://github.com/caronc/apprise/wiki/Notify_pushbullet) | pbul:// | (TCP) 443 | pbul://accesstoken<br />pbul://accesstoken/#channel<br/>pbul://accesstoken/A_DEVICE_ID<br />pbul://accesstoken/email@address.com<br />pbul://accesstoken/#channel/#channel2/email@address.net/DEVICE
|
||||||
|
| [Pushjet](https://github.com/caronc/apprise/wiki/Notify_pushjet) | pjet:// | (TCP) 80 | pjet://secret@hostname<br />pjet://secret@hostname:port<br />pjets://secret@hostname<br />pjets://secret@hostname:port
|
||||||
| [Pushed](https://github.com/caronc/apprise/wiki/Notify_pushed) | pushed:// | (TCP) 443 | pushed://appkey/appsecret/<br/>pushed://appkey/appsecret/#ChannelAlias<br/>pushed://appkey/appsecret/#ChannelAlias1/#ChannelAlias2/#ChannelAliasN<br/>pushed://appkey/appsecret/@UserPushedID<br/>pushed://appkey/appsecret/@UserPushedID1/@UserPushedID2/@UserPushedIDN
|
| [Pushed](https://github.com/caronc/apprise/wiki/Notify_pushed) | pushed:// | (TCP) 443 | pushed://appkey/appsecret/<br/>pushed://appkey/appsecret/#ChannelAlias<br/>pushed://appkey/appsecret/#ChannelAlias1/#ChannelAlias2/#ChannelAliasN<br/>pushed://appkey/appsecret/@UserPushedID<br/>pushed://appkey/appsecret/@UserPushedID1/@UserPushedID2/@UserPushedIDN
|
||||||
| [Pushjet](https://github.com/caronc/apprise/wiki/Notify_pushjet) | pjet:// | (TCP) 80 | pjet://secret<br />pjet://secret@hostname<br />pjet://secret@hostname:port<br />pjets://secret@hostname<br />pjets://secret@hostname:port<br /><i>Note: if no hostname defined https://api.pushjet.io will be used
|
|
||||||
| [Pushjet](https://github.com/caronc/apprise/wiki/Notify_pushjet) | pjet:// | (TCP) 80 | pjet://secret<br />pjet://secret@hostname<br />pjet://secret@hostname:port<br />pjets://secret@hostname<br />pjets://secret@hostname:port<br /><i>Note: if no hostname defined https://api.pushjet.io will be used
|
|
||||||
| [Pushover](https://github.com/caronc/apprise/wiki/Notify_pushover) | pover:// | (TCP) 443 | pover://user@token<br />pover://user@token/DEVICE<br />pover://user@token/DEVICE1/DEVICE2/DEVICEN<br />_Note: you must specify both your user_id and token_
|
| [Pushover](https://github.com/caronc/apprise/wiki/Notify_pushover) | pover:// | (TCP) 443 | pover://user@token<br />pover://user@token/DEVICE<br />pover://user@token/DEVICE1/DEVICE2/DEVICEN<br />_Note: you must specify both your user_id and token_
|
||||||
| [Rocket.Chat](https://github.com/caronc/apprise/wiki/Notify_rocketchat) | rocket:// or rockets:// | (TCP) 80 or 443 | rocket://user:password@hostname/RoomID/Channel<br />rockets://user:password@hostname:443/Channel1/Channel1/RoomID<br />rocket://user:password@hostname/Channel
|
| [Rocket.Chat](https://github.com/caronc/apprise/wiki/Notify_rocketchat) | rocket:// or rockets:// | (TCP) 80 or 443 | rocket://user:password@hostname/RoomID/Channel<br />rockets://user:password@hostname:443/Channel1/Channel1/RoomID<br />rocket://user:password@hostname/Channel
|
||||||
| [Slack](https://github.com/caronc/apprise/wiki/Notify_slack) | slack:// | (TCP) 443 | slack://TokenA/TokenB/TokenC/Channel<br />slack://botname@TokenA/TokenB/TokenC/Channel<br />slack://user@TokenA/TokenB/TokenC/Channel1/Channel2/ChannelN
|
| [Slack](https://github.com/caronc/apprise/wiki/Notify_slack) | slack:// | (TCP) 443 | slack://TokenA/TokenB/TokenC/Channel<br />slack://botname@TokenA/TokenB/TokenC/Channel<br />slack://user@TokenA/TokenB/TokenC/Channel1/Channel2/ChannelN
|
||||||
|
|
|
@ -43,9 +43,6 @@ class NotifyPushjet(NotifyBase):
|
||||||
# The default descriptive name associated with the Notification
|
# The default descriptive name associated with the Notification
|
||||||
service_name = 'Pushjet'
|
service_name = 'Pushjet'
|
||||||
|
|
||||||
# The services URL
|
|
||||||
service_url = 'https://pushjet.io/'
|
|
||||||
|
|
||||||
# The default protocol
|
# The default protocol
|
||||||
protocol = 'pjet'
|
protocol = 'pjet'
|
||||||
|
|
||||||
|
@ -66,21 +63,16 @@ class NotifyPushjet(NotifyBase):
|
||||||
Perform Pushjet Notification
|
Perform Pushjet Notification
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
if self.user and self.host:
|
server = "http://"
|
||||||
server = "http://"
|
if self.secure:
|
||||||
if self.secure:
|
server = "https://"
|
||||||
server = "https://"
|
|
||||||
|
|
||||||
server += self.host
|
server += self.host
|
||||||
if self.port:
|
if self.port:
|
||||||
server += ":" + str(self.port)
|
server += ":" + str(self.port)
|
||||||
|
|
||||||
api = pushjet.Api(server)
|
api = pushjet.Api(server)
|
||||||
service = api.Service(secret_key=self.user)
|
service = api.Service(secret_key=self.user)
|
||||||
|
|
||||||
else:
|
|
||||||
api = pushjet.Api(pushjet.DEFAULT_API_URL)
|
|
||||||
service = api.Service(secret_key=self.host)
|
|
||||||
|
|
||||||
service.send(body, title)
|
service.send(body, title)
|
||||||
self.logger.info('Sent Pushjet notification.')
|
self.logger.info('Sent Pushjet notification.')
|
||||||
|
@ -91,3 +83,28 @@ class NotifyPushjet(NotifyBase):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def parse_url(url):
|
||||||
|
"""
|
||||||
|
Parses the URL and returns enough arguments that can allow
|
||||||
|
us to substantiate this object.
|
||||||
|
|
||||||
|
Syntax:
|
||||||
|
pjet://secret@hostname
|
||||||
|
pjet://secret@hostname:port
|
||||||
|
pjets://secret@hostname
|
||||||
|
pjets://secret@hostname:port
|
||||||
|
|
||||||
|
"""
|
||||||
|
results = NotifyBase.parse_url(url)
|
||||||
|
|
||||||
|
if not results:
|
||||||
|
# We're done early as we couldn't load the results
|
||||||
|
return results
|
||||||
|
|
||||||
|
if not results.get('user'):
|
||||||
|
# a username is required
|
||||||
|
return None
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
|
@ -38,9 +38,9 @@ TEST_URLS = (
|
||||||
('pjets://', {
|
('pjets://', {
|
||||||
'instance': None,
|
'instance': None,
|
||||||
}),
|
}),
|
||||||
# Default query (uses pushjet server)
|
# You must specify a username
|
||||||
('pjet://%s' % ('a' * 32), {
|
('pjet://%s' % ('a' * 32), {
|
||||||
'instance': plugins.NotifyPushjet,
|
'instance': None,
|
||||||
}),
|
}),
|
||||||
# Specify your own server
|
# Specify your own server
|
||||||
('pjet://%s@localhost' % ('a' * 32), {
|
('pjet://%s@localhost' % ('a' * 32), {
|
||||||
|
|
Loading…
Reference in New Issue