From 7f77a456bed95da316bd2ec3e6a79361cfad6558 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Wed, 29 Nov 2017 19:51:18 -0500 Subject: [PATCH] added documentation on how to use the module --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/README.md b/README.md index ffcbee6b..2b1d5282 100644 --- a/README.md +++ b/README.md @@ -51,3 +51,44 @@ Apprise have some email services built right into it (such as hotmail, gmail, et | [JSON](https://github.com/caronc/apprise/wiki/Notify_Custom_JSON) | json:// or jsons:// | (TCP) 80 or 443 | json://hostname
json://user@hostname
json://user:password@hostname:port
json://hostname/a/path/to/post/to | [XML](https://github.com/caronc/apprise/wiki/Notify_Custom_XML) | xml:// or xmls:// | (TCP) 80 or 443 | xml://hostname
xml://user@hostname
xml://user:password@hostname:port
xml://hostname/a/path/to/post/to +## Installation +The easiest way is to install from pypi: +```bash +pip install apprise +``` +## Command Line +A small command line tool is also provided with this package called *notify*. If you know the server url's you wish to notify, you can simply provide them all on the command line and send your notifications that way: +```bash +# Send a notification to as many servers as you want to specify +notify -t 'my title' -b 'my notification body' \ + 'mailto://myemail:mypass@gmail.com' \ + 'pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b' + +# If you don't specify a --body (-b) then stdin is used allowing +# you to use the tool as part of your every day administration: +cat /proc/cpuinfo | notify -t 'cpu info' \ + 'mailto://myemail:mypass@gmail.com' +``` + +## Developers +To send a notification from within your python application, just do the following: +```python +import apprise + +# create an Apprise instance +apobj = Apprise() + +# Add all of the notification services by their server url. +# A sample email notification +apobj.add('mailto://myemail:mypass@gmail.com') + +# A sample pushbullet notification +apobj.add('pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b') + +# Then notify these services any time you desire. The below would +# notify all of the services loaded into our Apprise object. +apobj.notify( + title='my notification title', + body='what a great notification service!', +) +```