mirror of https://github.com/caronc/apprise
Updated of pjet:// docs+url as online service is no longer available; refs #46
parent
042c5ed2da
commit
7345481a4e
|
@ -45,7 +45,7 @@ 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
|
||||
| [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
|
||||
| [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@hostname<br />pjet://secret@hostname:port<br />pjets://secret@hostname<br />pjets://secret@hostname:port
|
||||
| [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
|
||||
| [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
|
||||
service_name = 'Pushjet'
|
||||
|
||||
# The services URL
|
||||
service_url = 'https://pushjet.io/'
|
||||
|
||||
# The default protocol
|
||||
protocol = 'pjet'
|
||||
|
||||
|
@ -66,21 +63,16 @@ class NotifyPushjet(NotifyBase):
|
|||
Perform Pushjet Notification
|
||||
"""
|
||||
try:
|
||||
if self.user and self.host:
|
||||
server = "http://"
|
||||
if self.secure:
|
||||
server = "https://"
|
||||
server = "http://"
|
||||
if self.secure:
|
||||
server = "https://"
|
||||
|
||||
server += self.host
|
||||
if self.port:
|
||||
server += ":" + str(self.port)
|
||||
server += self.host
|
||||
if self.port:
|
||||
server += ":" + str(self.port)
|
||||
|
||||
api = pushjet.Api(server)
|
||||
service = api.Service(secret_key=self.user)
|
||||
|
||||
else:
|
||||
api = pushjet.Api(pushjet.DEFAULT_API_URL)
|
||||
service = api.Service(secret_key=self.host)
|
||||
api = pushjet.Api(server)
|
||||
service = api.Service(secret_key=self.user)
|
||||
|
||||
service.send(body, title)
|
||||
self.logger.info('Sent Pushjet notification.')
|
||||
|
@ -91,3 +83,28 @@ class NotifyPushjet(NotifyBase):
|
|||
return False
|
||||
|
||||
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://', {
|
||||
'instance': None,
|
||||
}),
|
||||
# Default query (uses pushjet server)
|
||||
# You must specify a username
|
||||
('pjet://%s' % ('a' * 32), {
|
||||
'instance': plugins.NotifyPushjet,
|
||||
'instance': None,
|
||||
}),
|
||||
# Specify your own server
|
||||
('pjet://%s@localhost' % ('a' * 32), {
|
||||
|
|
Loading…
Reference in New Issue