Skip to content

Instantly share code, notes, and snippets.

View caronc's full-sized avatar

Chris Caron caronc

View GitHub Profile
@caronc
caronc / async_await.py
Created December 30, 2020 22:20
A simple Apprise Example (for Python v3+) leveraging async/await
# Under the hood, the NotifyBase class becomes AsyncNotifyBase() when Python 3 is detected
# see https://github.com/caronc/apprise/blob/ef2057c10aabd8119796338f41cd7970daeaacf9/apprise/py3compat/asyncio.py#L96
# The big difference is this introduces a new function called async_notify()
# which is called under the hood when you call Apprise().notify().
import apprise
import asyncio
# Add say... 2 entries:
aobj = apprise.Apprise()
aobj.add('mailto://user:[email protected]')
# Send 'HTML' content to Slack via Apprise.
# At this time (Mar 12th, 2021), Apprise can not convert HTML -> Markdown
# but luckily there are lots of tools that can do this for you:
# here is one; Requirement:
# > pip install html2markdown
import html2markdown
import apprise
# convert your HTML code to it's markdown equivalent: