From fbe208c29ed1e4f2aa329941241a8bab8e5226fc Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Sat, 16 Dec 2023 14:48:54 -0500 Subject: [PATCH] Updated Development_API (markdown) --- Development_API.md | 70 ++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/Development_API.md b/Development_API.md index c1441dc..47ac99e 100644 --- a/Development_API.md +++ b/Development_API.md @@ -10,10 +10,10 @@ * [`details()`](#details-dynamic-view-into-available-notification-services-apprise-offers) * [`async_notify()`](#async_notify--leveraging-await-to-send-notifications) * [The Apprise Asset Object](#the-apprise-asset-object) - * **Advanced**: - * [The Apprise Notification Object](#the-apprise-notification-object) * **Features**: * [Pickle Support](#pickleserialization-support) + * **Advanced**: + * [The Apprise Notification Object](#the-apprise-notification-object) # Development API @@ -359,38 +359,7 @@ apobj = apprise.Apprise(asset=asset) # default configuration has been over-ridden. ``` -## The Apprise Notification Object -The **[[The Apprise Object|Development_API#the-apprise-object]]** actually already does a really good managing these for you. But if you want to manage the notifications yourself here is how you can do it: - -```python -# Import this library -import apprise - -# Instantiate an object. This is what the apprise object -# would have otherwise done under the hood: - obj = apprise.Apprise.instantiate('glib://') - -# Now you can use the notify() function to pass notifications. -# notify() is similar to Apprise.notify() except the overhead of -# of tagging is not present. There also no handling of the -# the text input type (HTML, MARKUP, etc). This is on you -# to manipulate before passing in the content. -obj.notify( - body=u"A test message", - title=u"a title", -) - -# send() is a very low level call which directly posts the -# body and title you specify to the remote notification server -# There is NO data manipulation here, no overflow handling -# nothing. But this allows you to free form your own -# messages and pass them along using the apprise handling -obj.send( - body=u"A test message", - title=u"a title", -) -``` - +# Features ## Pickle/Serialization Support You can Serialize your loaded notifications so they can be restored later on: ```python @@ -422,4 +391,37 @@ apobj = pickle.loads(serialized) # Perhaps we previously wrote it to disk, well we can load our data this way as well: with open("myfile.txt", "r+") as file: apobj = pickle.loads(file.read()) +``` + +# Advanced +## The Apprise Notification Object +The **[[The Apprise Object|Development_API#the-apprise-object]]** actually already does a really good managing these for you. But if you want to manage the notifications yourself here is how you can do it: + +```python +# Import this library +import apprise + +# Instantiate an object. This is what the apprise object +# would have otherwise done under the hood: + obj = apprise.Apprise.instantiate('glib://') + +# Now you can use the notify() function to pass notifications. +# notify() is similar to Apprise.notify() except the overhead of +# of tagging is not present. There also no handling of the +# the text input type (HTML, MARKUP, etc). This is on you +# to manipulate before passing in the content. +obj.notify( + body=u"A test message", + title=u"a title", +) + +# send() is a very low level call which directly posts the +# body and title you specify to the remote notification server +# There is NO data manipulation here, no overflow handling +# nothing. But this allows you to free form your own +# messages and pass them along using the apprise handling +obj.send( + body=u"A test message", + title=u"a title", +) ``` \ No newline at end of file