code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def _room_join(self, room): """ Joins a matrix room if we're not already in it. Otherwise it attempts to create it if it doesn't exist and always returns the room_id if it was successful, otherwise it returns None """ if not self.access_token: # We can't joi...
Joins a matrix room if we're not already in it. Otherwise it attempts to create it if it doesn't exist and always returns the room_id if it was successful, otherwise it returns None
_room_join
python
caronc/apprise
apprise/plugins/matrix.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/matrix.py
BSD-2-Clause
def _room_create(self, room): """ Creates a matrix room and return it's room_id if successful otherwise None is returned. """ if not self.access_token: # We can't create a room if we're not logged in return None if not isinstance(room, str): ...
Creates a matrix room and return it's room_id if successful otherwise None is returned.
_room_create
python
caronc/apprise
apprise/plugins/matrix.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/matrix.py
BSD-2-Clause
def _joined_rooms(self): """ Returns a list of the current rooms the logged in user is a part of. """ if not self.access_token: # No list is possible return list() postokay, response = self._fetch( '/joined_rooms', payload=None, metho...
Returns a list of the current rooms the logged in user is a part of.
_joined_rooms
python
caronc/apprise
apprise/plugins/matrix.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/matrix.py
BSD-2-Clause
def _room_id(self, room): """Get room id from its alias. Args: room (str): The room alias name. Returns: returns the room id if it can, otherwise it returns None """ if not self.access_token: # We can't get a room id if we're not logged in ...
Get room id from its alias. Args: room (str): The room alias name. Returns: returns the room id if it can, otherwise it returns None
_room_id
python
caronc/apprise
apprise/plugins/matrix.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/matrix.py
BSD-2-Clause
def _fetch(self, path, payload=None, params={}, attachment=None, method='POST', url_override=None): """ Wrapper to request.post() to manage it's response better and make the send() function cleaner and easier to maintain. This function returns True if the _post was succes...
Wrapper to request.post() to manage it's response better and make the send() function cleaner and easier to maintain. This function returns True if the _post was successful and False if it wasn't. this function returns the status code if url_override is used
_fetch
python
caronc/apprise
apprise/plugins/matrix.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/matrix.py
BSD-2-Clause
def parse_native_url(url): """ Support https://webhooks.t2bot.io/api/v1/matrix/hook/WEBHOOK_TOKEN/ """ result = re.match( r'^https?://webhooks\.t2bot\.io/api/v[0-9]+/matrix/hook/' r'(?P<webhook_token>[A-Z0-9_-]+)/?' r'(?P<params>\?.+)?$', url, re.I) ...
Support https://webhooks.t2bot.io/api/v1/matrix/hook/WEBHOOK_TOKEN/
parse_native_url
python
caronc/apprise
apprise/plugins/matrix.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/matrix.py
BSD-2-Clause
def parse_native_url(url): """ Support parsing the webhook straight from URL https://HOST:443/workflows/WORKFLOWID/triggers/manual/paths/invoke https://mattermost.HOST/hooks/TOKEN """ # Match our workflows webhook URL and re-assemble result = re.match( ...
Support parsing the webhook straight from URL https://HOST:443/workflows/WORKFLOWID/triggers/manual/paths/invoke https://mattermost.HOST/hooks/TOKEN
parse_native_url
python
caronc/apprise
apprise/plugins/mattermost.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/mattermost.py
BSD-2-Clause
def parse_url(url): """ There are no parameters nessisary for this protocol; simply having windows:// is all you need. This function just makes sure that is in place. """ results = NotifyBase.parse_url(url) if not results: # We're done early as we c...
There are no parameters nessisary for this protocol; simply having windows:// is all you need. This function just makes sure that is in place.
parse_url
python
caronc/apprise
apprise/plugins/mqtt.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/mqtt.py
BSD-2-Clause
def __init__(self, token_a, token_b, token_c, token_d=None, team=None, version=None, include_image=True, template=None, tokens=None, **kwargs): """ Initialize Microsoft Teams Object You can optional specify a template and identify arguments you wish to ...
Initialize Microsoft Teams Object You can optional specify a template and identify arguments you wish to populate your template with when posting. Some reserved template arguments that can not be over-ridden are: `body`, `title`, and `type`.
__init__
python
caronc/apprise
apprise/plugins/msteams.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/msteams.py
BSD-2-Clause
def gen_payload(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """ This function generates our payload whether it be the generic one Apprise generates by default, or one provided by a specified external template. """ # Acquire our to-be...
This function generates our payload whether it be the generic one Apprise generates by default, or one provided by a specified external template.
gen_payload
python
caronc/apprise
apprise/plugins/msteams.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/msteams.py
BSD-2-Clause
def parse_native_url(url): """ Legacy Support: https://outlook.office.com/webhook/ABCD/IncomingWebhook/DEFG/HIJK New Hook Support: https://team-name.office.com/webhook/ABCD/IncomingWebhook/DEFG/HIJK Newer Hook Support: https://team-name.office.com/we...
Legacy Support: https://outlook.office.com/webhook/ABCD/IncomingWebhook/DEFG/HIJK New Hook Support: https://team-name.office.com/webhook/ABCD/IncomingWebhook/DEFG/HIJK Newer Hook Support: https://team-name.office.com/webhook/ABCD/IncomingWebhook/DEFG/HIJK/V...
parse_native_url
python
caronc/apprise
apprise/plugins/msteams.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/msteams.py
BSD-2-Clause
def __init__(self, apikey=None, include_image=None, event=None, targets=None, source=None, **kwargs): """ Initialize Notifiarr Object headers can be a dictionary of key/value pairs that you want to additionally include as part of the server headers to post with ...
Initialize Notifiarr Object headers can be a dictionary of key/value pairs that you want to additionally include as part of the server headers to post with
__init__
python
caronc/apprise
apprise/plugins/notifiarr.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/notifiarr.py
BSD-2-Clause
def authenticate(self): """ Logs into and acquires us an authentication token to work with """ if self.token and self.token_expiry > datetime.now(): # If we're already authenticated and our token is still valid self.logger.debug( 'Already authenti...
Logs into and acquires us an authentication token to work with
authenticate
python
caronc/apprise
apprise/plugins/office365.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/office365.py
BSD-2-Clause
def _fetch(self, method, url, payload, params=None): """ Performs server retrieval/update and returns JSON Response """ headers = { 'User-Agent': self.app_id, 'Content-Type': 'application/json', 'Authorization': 'GenieKey {}'.format(self.apikey), ...
Performs server retrieval/update and returns JSON Response
_fetch
python
caronc/apprise
apprise/plugins/opsgenie.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/opsgenie.py
BSD-2-Clause
def parse_url(url): """ Parses the URL and returns enough arguments that can allow us to substantiate this object. """ results = NotifyBase.parse_url(url, verify_host=False) if not results: # We're done early as we couldn't parse the URL return res...
Parses the URL and returns enough arguments that can allow us to substantiate this object.
parse_url
python
caronc/apprise
apprise/plugins/pushdeer.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/pushdeer.py
BSD-2-Clause
def _send(self, payload, notify_type, **kwargs): """ A lower level call that directly pushes a payload to the Pushed Notification servers. This should never be called directly; it is referenced automatically through the send() function. """ headers = { 'User...
A lower level call that directly pushes a payload to the Pushed Notification servers. This should never be called directly; it is referenced automatically through the send() function.
_send
python
caronc/apprise
apprise/plugins/pushed.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/pushed.py
BSD-2-Clause
def parse_url(url): """ Parses the URL and returns enough arguments that can allow us to re-instantiate this object. Syntax: pjet://hostname/secret_key pjet://hostname:port/secret_key pjet://user:pass@hostname/secret_key pjet://user:pass@hostn...
Parses the URL and returns enough arguments that can allow us to re-instantiate this object. Syntax: pjet://hostname/secret_key pjet://hostname:port/secret_key pjet://user:pass@hostname/secret_key pjet://user:pass@hostname:port/secret_key ...
parse_url
python
caronc/apprise
apprise/plugins/pushjet.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/pushjet.py
BSD-2-Clause
def login(self): """ A simple wrapper to authenticate with the Reddit Server """ # Prepare our payload payload = { 'grant_type': 'password', 'username': self.user, 'password': self.password, } # Enforce a False flag setting be...
A simple wrapper to authenticate with the Reddit Server
login
python
caronc/apprise
apprise/plugins/reddit.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/reddit.py
BSD-2-Clause
def _fetch(self, url, payload=None): """ Wrapper to Reddit API requests object """ # use what was specified, otherwise build headers dynamically headers = { 'User-Agent': '{} v{}'.format(__title__, __version__) } if self.__access_token: #...
Wrapper to Reddit API requests object
_fetch
python
caronc/apprise
apprise/plugins/reddit.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/reddit.py
BSD-2-Clause
def _send(self, payload, channel_id, retries=1, **kwargs): """ Wrapper to the requests (post) object """ headers = { 'User-Agent': self.app_id, 'X-Bot-Token': self.bot_token, 'Content-Type': 'application/json; charset=utf-8', 'Accept': 'a...
Wrapper to the requests (post) object
_send
python
caronc/apprise
apprise/plugins/revolt.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/revolt.py
BSD-2-Clause
def url(self, privacy=False, *args, **kwargs): """ Returns the URL built dynamically based on specified arguments. """ # Define any URL parameters params = {} if self.icon_url: params['icon_url'] = self.icon_url if self.link: params['ur...
Returns the URL built dynamically based on specified arguments.
url
python
caronc/apprise
apprise/plugins/revolt.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/revolt.py
BSD-2-Clause
def _send_basic_notification(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """ Authenticates with the server using a user/pass combo for notifications. """ # Track whether we authenticated okay if self.mode == RocketChatAu...
Authenticates with the server using a user/pass combo for notifications.
_send_basic_notification
python
caronc/apprise
apprise/plugins/rocketchat.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/rocketchat.py
BSD-2-Clause
def parse_native_url(url): """ Support https://RYVER_ORG.ryver.com/application/webhook/TOKEN """ result = re.match( r'^https?://(?P<org>[A-Z0-9_-]+)\.ryver\.com/application/webhook/' r'(?P<webhook_token>[A-Z0-9]+)/?' r'(?P<params>\?.+)?$', url, re.I) ...
Support https://RYVER_ORG.ryver.com/application/webhook/TOKEN
parse_native_url
python
caronc/apprise
apprise/plugins/ryver.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/ryver.py
BSD-2-Clause
def send(self, body, title='', notify_type=NotifyType.INFO, attach=None, **kwargs): """ wrapper to send_notification since we can alert more then one channel """ if not self.targets: # There is no one to email; we're done self.logger.warning( ...
wrapper to send_notification since we can alert more then one channel
send
python
caronc/apprise
apprise/plugins/ses.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/ses.py
BSD-2-Clause
def _post(self, payload, to): """ Wrapper to request.post() to manage it's response better and make the send() function cleaner and easier to maintain. This function returns True if the _post was successful and False if it wasn't. """ # Always call throttle befo...
Wrapper to request.post() to manage it's response better and make the send() function cleaner and easier to maintain. This function returns True if the _post was successful and False if it wasn't.
_post
python
caronc/apprise
apprise/plugins/ses.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/ses.py
BSD-2-Clause
def aws_prepare_request(self, payload, reference=None): """ Takes the intended payload and returns the headers for it. The payload is presumed to have been already urlencoded() """ # Define our AWS SES header headers = { 'User-Agent': self.app_id, ...
Takes the intended payload and returns the headers for it. The payload is presumed to have been already urlencoded()
aws_prepare_request
python
caronc/apprise
apprise/plugins/ses.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/ses.py
BSD-2-Clause
def aws_auth_signature(self, to_sign, reference): """ Generates a AWS v4 signature based on provided payload which should be in the form of a string. """ def _sign(key, msg, to_hex=False): """ Perform AWS Signing """ if to_hex: ...
Generates a AWS v4 signature based on provided payload which should be in the form of a string.
aws_auth_signature
python
caronc/apprise
apprise/plugins/ses.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/ses.py
BSD-2-Clause
def aws_response_to_dict(aws_response): """ Takes an AWS Response object as input and returns it as a dictionary but not befor extracting out what is useful to us first. eg: IN: <SendRawEmailResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/...
Takes an AWS Response object as input and returns it as a dictionary but not befor extracting out what is useful to us first. eg: IN: <SendRawEmailResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> <SendRawEmailResult> ...
aws_response_to_dict
python
caronc/apprise
apprise/plugins/ses.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/ses.py
BSD-2-Clause
def parse_url(url): """ Parse the URL and return arguments required to initialize this plugin """ # NotifyBase.parse_url() will make the initial parsing of your string # very easy to use. It will tokenize the entire URL for you. The # tokens are then passed into your __i...
Parse the URL and return arguments required to initialize this plugin
parse_url
python
caronc/apprise
apprise/plugins/sfr.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/sfr.py
BSD-2-Clause
def _encrypt(self, content): """ Encrypts message for use with SimplePush """ if self._iv is None: # initialization vector and cache it self._iv = urandom(algorithms.AES.block_size // 8) # convert vector into hex string (used in payload) ...
Encrypts message for use with SimplePush
_encrypt
python
caronc/apprise
apprise/plugins/simplepush.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/simplepush.py
BSD-2-Clause
def lookup_userid(self, email): """ Takes an email address and attempts to resolve/acquire it's user id for notification purposes. """ if email in self._lookup_users: # We're done as entry has already been retrieved return self._lookup_users[email] ...
Takes an email address and attempts to resolve/acquire it's user id for notification purposes.
lookup_userid
python
caronc/apprise
apprise/plugins/slack.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/slack.py
BSD-2-Clause
def parse_native_url(url): """ Support https://hooks.slack.com/services/TOKEN_A/TOKEN_B/TOKEN_C """ result = re.match( r'^https?://hooks\.slack\.com/services/' r'(?P<token_a>[A-Z0-9]+)/' r'(?P<token_b>[A-Z0-9]+)/' r'(?P<token_c>[A-Z0-9]+)/...
Support https://hooks.slack.com/services/TOKEN_A/TOKEN_B/TOKEN_C
parse_native_url
python
caronc/apprise
apprise/plugins/slack.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/slack.py
BSD-2-Clause
def aws_response_to_dict(aws_response): """ Takes an AWS Response object as input and returns it as a dictionary but not befor extracting out what is useful to us first. eg: IN: <CreateTopicResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"...
Takes an AWS Response object as input and returns it as a dictionary but not befor extracting out what is useful to us first. eg: IN: <CreateTopicResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/"> <CreateTopicResult> ...
aws_response_to_dict
python
caronc/apprise
apprise/plugins/sns.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/sns.py
BSD-2-Clause
def __post(self, payload, retry): """ Performs the actual post and returns the response """ # Prepare our headers headers = { 'User-Agent': self.app_id, 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorizati...
Performs the actual post and returns the response
__post
python
caronc/apprise
apprise/plugins/sparkpost.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/sparkpost.py
BSD-2-Clause
def parse_native_url(url): """ Support https://alert.victorops.com/integrations/generic/20131114/ \ alert/apikey/routing_key """ result = re.match( r'^https?://alert\.victorops\.com/integrations/generic/' r'(?P<version>[0-9]+)/alert/(?P<apike...
Support https://alert.victorops.com/integrations/generic/20131114/ alert/apikey/routing_key
parse_native_url
python
caronc/apprise
apprise/plugins/splunk.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/splunk.py
BSD-2-Clause
def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """ Perform Streamlabs notification call (either donation or alert) """ headers = { 'User-Agent': self.app_id, } if self.call == StrmlabsCall.ALERT: data = { '...
Perform Streamlabs notification call (either donation or alert)
send
python
caronc/apprise
apprise/plugins/streamlabs.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/streamlabs.py
BSD-2-Clause
def parse_url(url): """ Parses the URL and returns enough arguments that can allow us to re-instantiate this object. Syntax: strmlabs://access_token """ results = NotifyBase.parse_url(url, verify_host=False) if not results: # We're done ear...
Parses the URL and returns enough arguments that can allow us to re-instantiate this object. Syntax: strmlabs://access_token
parse_url
python
caronc/apprise
apprise/plugins/streamlabs.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/streamlabs.py
BSD-2-Clause
def __init__(self, token=None, headers=None, file_url=None, **kwargs): """ Initialize Synology Chat Object headers can be a dictionary of key/value pairs that you want to additionally include as part of the server headers to post with """ super().__init__(**kwargs) ...
Initialize Synology Chat Object headers can be a dictionary of key/value pairs that you want to additionally include as part of the server headers to post with
__init__
python
caronc/apprise
apprise/plugins/synology.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/synology.py
BSD-2-Clause
def send_media(self, target, notify_type, payload={}, attach=None): """ Sends a sticker based on the specified notify type """ # Prepare our Headers headers = { 'User-Agent': self.app_id, } # Our function name and payload are determined on the path ...
Sends a sticker based on the specified notify type
send_media
python
caronc/apprise
apprise/plugins/telegram.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/telegram.py
BSD-2-Clause
def detect_bot_owner(self): """ Takes a bot and attempts to detect it's chat id from that """ headers = { 'User-Agent': self.app_id, 'Content-Type': 'application/json', } url = '%s%s/%s' % ( self.notify_url, self.bot_toke...
Takes a bot and attempts to detect it's chat id from that
detect_bot_owner
python
caronc/apprise
apprise/plugins/telegram.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/telegram.py
BSD-2-Clause
def login(self): """ A simple wrapper to authenticate with the Twist Server """ # Prepare our payload payload = { 'email': self.email, 'password': self.password, } # Reset our default workspace self.default_workspace = None ...
A simple wrapper to authenticate with the Twist Server
login
python
caronc/apprise
apprise/plugins/twist.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/twist.py
BSD-2-Clause
def logout(self): """ A simple wrapper to log out of the server """ if not self.token: # Nothing more to do return True # Send Logout Message postokay, response = self._fetch('users/logout') # reset our token self.token = None ...
A simple wrapper to log out of the server
logout
python
caronc/apprise
apprise/plugins/twist.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/twist.py
BSD-2-Clause
def get_workspaces(self): """ Returns all workspaces associated with this user account as a set This returned object is either an empty dictionary or one that looks like this: { 'workspace': <workspace_id>, 'workspace': <workspace_id>, '...
Returns all workspaces associated with this user account as a set This returned object is either an empty dictionary or one that looks like this: { 'workspace': <workspace_id>, 'workspace': <workspace_id>, 'workspace': <workspace_id>, ...
get_workspaces
python
caronc/apprise
apprise/plugins/twist.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/twist.py
BSD-2-Clause
def get_channels(self, wid): """ Simply returns the channel objects associated with the specified workspace id. This returned object is either an empty dictionary or one that looks like this: { 'channel1': <channel_id>, 'channel2': <channel_i...
Simply returns the channel objects associated with the specified workspace id. This returned object is either an empty dictionary or one that looks like this: { 'channel1': <channel_id>, 'channel2': <channel_id>, 'channel3': <channel_id...
get_channels
python
caronc/apprise
apprise/plugins/twist.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/twist.py
BSD-2-Clause
def _channel_migration(self): """ A simple wrapper to get all of the current workspaces including the default one. This plays a role in what channel(s) get notified and where. A cache lookup has overhead, and is only required to be preformed if the user specified channe...
A simple wrapper to get all of the current workspaces including the default one. This plays a role in what channel(s) get notified and where. A cache lookup has overhead, and is only required to be preformed if the user specified channels by their string value
_channel_migration
python
caronc/apprise
apprise/plugins/twist.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/twist.py
BSD-2-Clause
def _fetch(self, url, payload=None, method='POST', login=False): """ Wrapper to Twist API requests object """ # use what was specified, otherwise build headers dynamically headers = { 'User-Agent': self.app_id, } headers['Content-Type'] = \ ...
Wrapper to Twist API requests object
_fetch
python
caronc/apprise
apprise/plugins/twist.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/twist.py
BSD-2-Clause
def _user_lookup(self, screen_name, lazy=True): """ Looks up a screen name and returns the user id the screen_name can be a list/set/tuple as well """ # Contains a mapping of screen_name to id results = {} # Build a unique set of names names = parse_lis...
Looks up a screen name and returns the user id the screen_name can be a list/set/tuple as well
_user_lookup
python
caronc/apprise
apprise/plugins/twitter.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/twitter.py
BSD-2-Clause
def _fetch(self, url, payload=None, method='POST', json=True): """ Wrapper to Twitter API requests object """ headers = { 'User-Agent': self.app_id, } data = None files = None # Open our attachment path if required: if isinstance(pay...
Wrapper to Twitter API requests object
_fetch
python
caronc/apprise
apprise/plugins/twitter.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/twitter.py
BSD-2-Clause
def parse_native_url(url): """ Support https://api.ciscospark.com/v1/webhooks/incoming/WEBHOOK_TOKEN """ result = re.match( r'^https?://(api\.ciscospark\.com|webexapis\.com)' r'/v[1-9][0-9]*/webhooks/incoming/' r'(?P<webhook_token>[A-Z0-9_-]+)/?' ...
Support https://api.ciscospark.com/v1/webhooks/incoming/WEBHOOK_TOKEN
parse_native_url
python
caronc/apprise
apprise/plugins/webexteams.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/webexteams.py
BSD-2-Clause
def parse_native_url(url): """ Support https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=BOTKEY """ result = re.match( r'^https?://qyapi\.weixin\.qq\.com/cgi-bin/webhook/send/?\?key=' r'(?P<key>[A-Z0-9_-]+)/?' r'&?(?P<params>.+)?$', url, re.I) ...
Support https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=BOTKEY
parse_native_url
python
caronc/apprise
apprise/plugins/wecombot.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/wecombot.py
BSD-2-Clause
def parse_native_url(url): """ Support parsing the webhook straight out of workflows https://HOST:443/workflows/WORKFLOWID/triggers/manual/paths/invoke """ # Match our workflows webhook URL and re-assemble result = re.match( r'^https?://(?P<host>[A-Z0-9_....
Support parsing the webhook straight out of workflows https://HOST:443/workflows/WORKFLOWID/triggers/manual/paths/invoke
parse_native_url
python
caronc/apprise
apprise/plugins/workflows.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/workflows.py
BSD-2-Clause
def _payload_60(self, title, body, notify_type, **kwargs): """ Builds payload for KODI API v6.0 Returns (headers, payload) """ # prepare JSON Object payload = { 'jsonrpc': '2.0', 'method': 'GUI.ShowNotification', 'params': { ...
Builds payload for KODI API v6.0 Returns (headers, payload)
_payload_60
python
caronc/apprise
apprise/plugins/xbmc.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/xbmc.py
BSD-2-Clause
def _payload_20(self, title, body, notify_type, **kwargs): """ Builds payload for XBMC API v2.0 Returns (headers, payload) """ # prepare JSON Object payload = { 'jsonrpc': '2.0', 'method': 'GUI.ShowNotification', 'params': { ...
Builds payload for XBMC API v2.0 Returns (headers, payload)
_payload_20
python
caronc/apprise
apprise/plugins/xbmc.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/xbmc.py
BSD-2-Clause
def _sanitize_token(tokens, default_delimiter): """ This is called by the details() function and santizes the output by populating expected and consistent arguments if they weren't otherwise specified. """ # Used for tracking groups group_map = {} # Iterate over our tokens for key...
This is called by the details() function and santizes the output by populating expected and consistent arguments if they weren't otherwise specified.
_sanitize_token
python
caronc/apprise
apprise/plugins/__init__.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/__init__.py
BSD-2-Clause
def details(plugin): """ Provides templates that can be used by developers to build URLs dynamically. If a list of templates is provided, then they will be used over the default value. If a list of tokens are provided, then they will over-ride any additional settings built from this script...
Provides templates that can be used by developers to build URLs dynamically. If a list of templates is provided, then they will be used over the default value. If a list of tokens are provided, then they will over-ride any additional settings built from this script and/or will be appended ...
details
python
caronc/apprise
apprise/plugins/__init__.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/__init__.py
BSD-2-Clause
def requirements(plugin): """ Provides a list of packages and its requirement details """ requirements = { # Use the description to provide a human interpretable description of # what is required to make the plugin work. This is only nessisary # if there are package dependencies...
Provides a list of packages and its requirement details
requirements
python
caronc/apprise
apprise/plugins/__init__.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/__init__.py
BSD-2-Clause
def url_to_dict(url, secure_logging=True): """ Takes an apprise URL and returns the tokens associated with it if they can be acquired based on the plugins available. None is returned if the URL could not be parsed, otherwise the tokens are returned. These tokens can be loaded into apprise thro...
Takes an apprise URL and returns the tokens associated with it if they can be acquired based on the plugins available. None is returned if the URL could not be parsed, otherwise the tokens are returned. These tokens can be loaded into apprise through it's add() function.
url_to_dict
python
caronc/apprise
apprise/plugins/__init__.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/__init__.py
BSD-2-Clause
def __init__(self, smtp_host=None, from_addr=None, secure_mode=None, targets=None, cc=None, bcc=None, reply_to=None, headers=None, use_pgp=None, pgp_key=None, **kwargs): """ Initialize Email Object The smtp_host and secure_mode can be automatically detected dep...
Initialize Email Object The smtp_host and secure_mode can be automatically detected depending on how the URL was built
__init__
python
caronc/apprise
apprise/plugins/email/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/email/base.py
BSD-2-Clause
def apply_email_defaults(self, secure_mode=None, port=None, **kwargs): """ A function that prefills defaults based on the email it was provided. """ if self.smtp_host or not self.user: # SMTP Server was explicitly specified, therefore it is assumed # the ...
A function that prefills defaults based on the email it was provided.
apply_email_defaults
python
caronc/apprise
apprise/plugins/email/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/email/base.py
BSD-2-Clause
def url_identifier(self): """ Returns all of the identifiers that make this URL unique from another similar one. Targets or end points should never be identified here. """ return ( self.secure_protocol if self.secure else self.protocol, self.user, ...
Returns all of the identifiers that make this URL unique from another similar one. Targets or end points should never be identified here.
url_identifier
python
caronc/apprise
apprise/plugins/email/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/email/base.py
BSD-2-Clause
def _get_charset(input_string): """ Get utf-8 charset if non ascii string only Encode an ascii string to utf-8 is bad for email deliverability because some anti-spam gives a bad score for that like SUBJ_EXCESS_QP flag on Rspamd """ if not input_string: ...
Get utf-8 charset if non ascii string only Encode an ascii string to utf-8 is bad for email deliverability because some anti-spam gives a bad score for that like SUBJ_EXCESS_QP flag on Rspamd
_get_charset
python
caronc/apprise
apprise/plugins/email/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/email/base.py
BSD-2-Clause
def prepare_emails(subject, body, from_addr, to, cc=set(), bcc=set(), reply_to=set(), # Providing an SMTP Host helps improve Email Message-ID # and avoids getting flagged as spam smtp_host=None, # Can be e...
Generator for emails from_addr: must be in format: (from_name, from_addr) to: must be in the format: [(to_name, to_addr), (to_name, to_addr)), ...] cc: must be a set of email addresses bcc: must be a set of email addresses reply_to: m...
prepare_emails
python
caronc/apprise
apprise/plugins/email/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/email/base.py
BSD-2-Clause
def get(self, notify_type=NotifyType.INFO): """ Returns color or true/false value based on configuration """ if isinstance(self.color, bool) and self.color: # We want to use the asset value return self.asset.color(notify_type=notify_type) elif self.color...
Returns color or true/false value based on configuration
get
python
caronc/apprise
apprise/plugins/fcm/color.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/fcm/color.py
BSD-2-Clause
def __bool__(self): """ Allows this object to be wrapped in an 'if statement'. True is returned if a color was loaded """ return True if self.color is True or \ isinstance(self.color, str) else False
Allows this object to be wrapped in an 'if statement'. True is returned if a color was loaded
__bool__
python
caronc/apprise
apprise/plugins/fcm/color.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/fcm/color.py
BSD-2-Clause
def access_token(self): """ Returns our access token (if it hasn't expired yet) - if we do not have one we'll fetch one. - if it expired, we'll renew it - if a key simply can't be acquired, then we return None """ if not self.private_key or not self.content...
Returns our access token (if it hasn't expired yet) - if we do not have one we'll fetch one. - if it expired, we'll renew it - if a key simply can't be acquired, then we return None
access_token
python
caronc/apprise
apprise/plugins/fcm/oauth.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/fcm/oauth.py
BSD-2-Clause
def payload(self): """ Returns our payload depending on our mode """ return self.priority_map[self.priority][self.mode] \ if self.priority else {}
Returns our payload depending on our mode
payload
python
caronc/apprise
apprise/plugins/fcm/priority.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/fcm/priority.py
BSD-2-Clause
def access_token(self): """ Generates a access_token based on the keyfile provided """ keyfile = self.keyfile[0] if not keyfile: # We could not access the keyfile self.logger.error( 'Could not access FCM keyfile {}.'.format( ...
Generates a access_token based on the keyfile provided
access_token
python
caronc/apprise
apprise/plugins/fcm/__init__.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/fcm/__init__.py
BSD-2-Clause
def decode_b64_dict(di: dict) -> dict: """ decodes base64 dictionary previously encoded string entries prefixed with `b64:` are targeted """ di = copy.deepcopy(di) for k, v in di.items(): if not isinstance(v, str) or not v.startswith("b64:"): continue try: ...
decodes base64 dictionary previously encoded string entries prefixed with `b64:` are targeted
decode_b64_dict
python
caronc/apprise
apprise/utils/base64.py
https://github.com/caronc/apprise/blob/master/apprise/utils/base64.py
BSD-2-Clause
def encode_b64_dict(di: dict, encoding='utf-8') -> typing.Tuple[dict, bool]: """ Encodes dictionary entries containing binary types (int, float) into base64 Final product is always string based values """ di = copy.deepcopy(di) needs_decoding = False for k, v in di.items(): if isins...
Encodes dictionary entries containing binary types (int, float) into base64 Final product is always string based values
encode_b64_dict
python
caronc/apprise
apprise/utils/base64.py
https://github.com/caronc/apprise/blob/master/apprise/utils/base64.py
BSD-2-Clause
def tidy_path(path): """take a filename and or directory and attempts to tidy it up by removing trailing slashes and correcting any formatting issues. For example: ////absolute//path// becomes: /absolute/path """ # Windows path = TIDY_WIN_PATH_RE.sub('\\1', path.strip()) # Linux ...
take a filename and or directory and attempts to tidy it up by removing trailing slashes and correcting any formatting issues. For example: ////absolute//path// becomes: /absolute/path
tidy_path
python
caronc/apprise
apprise/utils/disk.py
https://github.com/caronc/apprise/blob/master/apprise/utils/disk.py
BSD-2-Clause
def dir_size(path, max_depth=3, missing_okay=True, _depth=0, _errors=None): """ Scans a provided path an returns it's size (in bytes) of path provided """ if _errors is None: _errors = set() if _depth > max_depth: _errors.add(path) return (0, _errors) total = 0 try...
Scans a provided path an returns it's size (in bytes) of path provided
dir_size
python
caronc/apprise
apprise/utils/disk.py
https://github.com/caronc/apprise/blob/master/apprise/utils/disk.py
BSD-2-Clause
def bytes_to_str(value): """ Covert an integer (in bytes) into it's string representation with acompanied unit value (such as B, KB, MB, GB, TB, etc) """ unit = 'B' try: value = float(value) except (ValueError, TypeError): return None if value >= 1024.0: value =...
Covert an integer (in bytes) into it's string representation with acompanied unit value (such as B, KB, MB, GB, TB, etc)
bytes_to_str
python
caronc/apprise
apprise/utils/disk.py
https://github.com/caronc/apprise/blob/master/apprise/utils/disk.py
BSD-2-Clause
def is_exclusive_match(logic, data, match_all=common.MATCH_ALL_TAG, match_always=common.MATCH_ALWAYS_TAG): """ The data variable should always be a set of strings that the logic can be compared against. It should be a set. If it isn't already, then it will be converted as such. ...
The data variable should always be a set of strings that the logic can be compared against. It should be a set. If it isn't already, then it will be converted as such. These identify the tags themselves. Our logic should be a list as well: - top level entries are treated as an 'or' - sec...
is_exclusive_match
python
caronc/apprise
apprise/utils/logic.py
https://github.com/caronc/apprise/blob/master/apprise/utils/logic.py
BSD-2-Clause
def dict_full_update(dict1, dict2): """ Takes 2 dictionaries (dict1 and dict2) that contain sub-dictionaries and gracefully merges them into dict1. This is similar to: dict1.update(dict2) except that internal dictionaries are also recursively applied. """ def _merge(dict1, dict2): f...
Takes 2 dictionaries (dict1 and dict2) that contain sub-dictionaries and gracefully merges them into dict1. This is similar to: dict1.update(dict2) except that internal dictionaries are also recursively applied.
dict_full_update
python
caronc/apprise
apprise/utils/logic.py
https://github.com/caronc/apprise/blob/master/apprise/utils/logic.py
BSD-2-Clause
def import_module(path, name): """ Load our module based on path """ spec = importlib.util.spec_from_file_location(name, path) try: module = importlib.util.module_from_spec(spec) sys.modules[name] = module spec.loader.exec_module(module) except Exception as e: #...
Load our module based on path
import_module
python
caronc/apprise
apprise/utils/module.py
https://github.com/caronc/apprise/blob/master/apprise/utils/module.py
BSD-2-Clause
def is_uuid(uuid): """Determine if the specified entry is uuid v4 string Args: address (str): The string you want to check. Returns: bool: Returns False if the specified element is not a uuid otherwise it returns True """ try: match = UUID4_RE.match(uuid) ...
Determine if the specified entry is uuid v4 string Args: address (str): The string you want to check. Returns: bool: Returns False if the specified element is not a uuid otherwise it returns True
is_uuid
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def is_phone_no(phone, min_len=10): """Determine if the specified entry is a phone number Args: phone (str): The string you want to check. min_len (int): Defines the smallest expected length of the phone before it's to be considered invalid. By default ...
Determine if the specified entry is a phone number Args: phone (str): The string you want to check. min_len (int): Defines the smallest expected length of the phone before it's to be considered invalid. By default the phone number can't be any larger th...
is_phone_no
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def is_call_sign(callsign): """Determine if the specified entry is a ham radio call sign Args: callsign (str): The string you want to check. Returns: bool: Returns False if the address specified is not a phone number """ try: result = IS_CALL_SIGN.match(callsign) i...
Determine if the specified entry is a ham radio call sign Args: callsign (str): The string you want to check. Returns: bool: Returns False if the address specified is not a phone number
is_call_sign
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def is_email(address): """Determine if the specified entry is an email address Args: address (str): The string you want to check. Returns: bool: Returns False if the address specified is not an email address and a dictionary of the parsed email if it is as: { ...
Determine if the specified entry is an email address Args: address (str): The string you want to check. Returns: bool: Returns False if the address specified is not an email address and a dictionary of the parsed email if it is as: { 'name': 'P...
is_email
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def parse_qsd(qs, simple=False, plus_to_space=False, sanitize=True): """ Query String Dictionary Builder A custom implimentation of the parse_qsl() function already provided by Python. This function is slightly more light weight and gives us more control over parsing out arguments such as the plus...
Query String Dictionary Builder A custom implimentation of the parse_qsl() function already provided by Python. This function is slightly more light weight and gives us more control over parsing out arguments such as the plus/+ symbol at the head of a key/value pair. qs should be a query str...
parse_qsd
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def parse_url(url, default_schema='http', verify_host=True, strict_port=False, simple=False, plus_to_space=False, sanitize=True): """A function that greatly simplifies the parsing of a url specified by the end user. Valid syntaxes are: <schema>://<user>@<host>:<port>/<path> <...
A function that greatly simplifies the parsing of a url specified by the end user. Valid syntaxes are: <schema>://<user>@<host>:<port>/<path> <schema>://<user>:<passwd>@<host>:<port>/<path> <schema>://<host>:<port>/<path> <schema>://<host>/<path> <schema>://<host> ...
parse_url
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def parse_bool(arg, default=False): """ Support string based boolean settings. If the content could not be parsed, then the default is returned. """ if isinstance(arg, str): # no = no - False # of = short for off - False # 0 = int for False # fa = short for False -...
Support string based boolean settings. If the content could not be parsed, then the default is returned.
parse_bool
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def parse_phone_no(*args, store_unparseable=True, prefix=False, **kwargs): """ Takes a string containing phone numbers separated by comma's and/or spaces and returns a list. """ result = [] for arg in args: if isinstance(arg, str) and arg: _result = (PHONE_NO_DETECTION_RE if...
Takes a string containing phone numbers separated by comma's and/or spaces and returns a list.
parse_phone_no
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def parse_call_sign(*args, store_unparseable=True, **kwargs): """ Takes a string containing ham radio call signs separated by comma and/or spacesand returns a list. """ result = [] for arg in args: if isinstance(arg, str) and arg: _result = CALL_SIGN_DETECTION_RE.findall(arg...
Takes a string containing ham radio call signs separated by comma and/or spacesand returns a list.
parse_call_sign
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def parse_emails(*args, store_unparseable=True, **kwargs): """ Takes a string containing emails separated by comma's and/or spaces and returns a list. """ result = [] for arg in args: if isinstance(arg, str) and arg: _result = EMAIL_DETECTION_RE.findall(arg) if _...
Takes a string containing emails separated by comma's and/or spaces and returns a list.
parse_emails
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def url_assembly(encode=False, **kwargs): """ This function reverses the parse_url() function by taking in the provided result set and re-assembling a URL """ def _no_encode(content, *args, **kwargs): # dummy function that does nothing to content return content _quote = quote i...
This function reverses the parse_url() function by taking in the provided result set and re-assembling a URL
url_assembly
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def urlencode(query, doseq=False, safe='', encoding=None, errors=None): """Convert a mapping object or a sequence of two-element tuples Wrapper to Python's unquote while remaining compatible with both Python 2 & 3 since the reference to this function changed between versions. The resulting string ...
Convert a mapping object or a sequence of two-element tuples Wrapper to Python's unquote while remaining compatible with both Python 2 & 3 since the reference to this function changed between versions. The resulting string is a series of key=value pairs separated by '&' characters, where both key ...
urlencode
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def parse_urls(*args, store_unparseable=True, **kwargs): """ Takes a string containing URLs separated by comma's and/or spaces and returns a list. """ result = [] for arg in args: if isinstance(arg, str) and arg: _result = URL_DETECTION_RE.findall(arg) if _result...
Takes a string containing URLs separated by comma's and/or spaces and returns a list.
parse_urls
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def validate_regex(value, regex=r'[^\s]+', flags=re.I, strip=True, fmt=None): """ A lot of the tokens, secrets, api keys, etc all have some regular expression validation they support. This hashes the regex after it's compiled and returns it's content if matched, otherwise it returns None. This fun...
A lot of the tokens, secrets, api keys, etc all have some regular expression validation they support. This hashes the regex after it's compiled and returns it's content if matched, otherwise it returns None. This function greatly increases performance as it prevents apprise modules from having to...
validate_regex
python
caronc/apprise
apprise/utils/parse.py
https://github.com/caronc/apprise/blob/master/apprise/utils/parse.py
BSD-2-Clause
def __init__(self, path, pub_keyfile=None, email=None, asset=None, **kwargs): """ Path should be the directory keys can be written and read from such as <notifyobject>.store.path Optionally additionally specify a keyfile to explicitly open """ #...
Path should be the directory keys can be written and read from such as <notifyobject>.store.path Optionally additionally specify a keyfile to explicitly open
__init__
python
caronc/apprise
apprise/utils/pgp.py
https://github.com/caronc/apprise/blob/master/apprise/utils/pgp.py
BSD-2-Clause
def keygen(self, email=None, name=None, force=False): """ Generates a set of keys based on email configured. """ try: # Create a new RSA key pair with 2048-bit strength key = pgpy.PGPKey.new( pgpy.constants.PubKeyAlgorithm.RSAEncryptOrSign, 2048) ...
Generates a set of keys based on email configured.
keygen
python
caronc/apprise
apprise/utils/pgp.py
https://github.com/caronc/apprise/blob/master/apprise/utils/pgp.py
BSD-2-Clause
def public_keyfile(self, *emails): """ Returns the first match of a useable public key based emails provided """ if not PGP_SUPPORT: msg = 'PGP Support unavailable; install PGPy library' logger.warning(msg) raise ApprisePGPException(msg) if s...
Returns the first match of a useable public key based emails provided
public_keyfile
python
caronc/apprise
apprise/utils/pgp.py
https://github.com/caronc/apprise/blob/master/apprise/utils/pgp.py
BSD-2-Clause
def public_key(self, *emails, autogen=None): """ Opens a spcified pgp public file and returns the key from it which is used to encrypt the message """ path = self.public_keyfile(*emails) if not path: if (autogen if autogen is not None else self.asset.pgp_autog...
Opens a spcified pgp public file and returns the key from it which is used to encrypt the message
public_key
python
caronc/apprise
apprise/utils/pgp.py
https://github.com/caronc/apprise/blob/master/apprise/utils/pgp.py
BSD-2-Clause
def encrypt(self, message, *emails): """ If provided a path to a pgp-key, content is encrypted """ # Acquire our key public_key = self.public_key(*emails) if not public_key: # Encryption not possible return False try: message_...
If provided a path to a pgp-key, content is encrypted
encrypt
python
caronc/apprise
apprise/utils/pgp.py
https://github.com/caronc/apprise/blob/master/apprise/utils/pgp.py
BSD-2-Clause
def prune(self): """ Prunes old entries from the public_key index """ self.__key_lookup = { key: value for key, value in self.__key_lookup.items() if value['expires'] > datetime.now(timezone.utc)}
Prunes old entries from the public_key index
prune
python
caronc/apprise
apprise/utils/pgp.py
https://github.com/caronc/apprise/blob/master/apprise/utils/pgp.py
BSD-2-Clause
def pub_keyfile(self): """ Returns the Public Keyfile Path if set otherwise it returns None This property returns False if a keyfile was provided, but was invalid """ return None if self._pub_keyfile is None else ( False if not self._pub_keyfile[0] else self._pub_keyf...
Returns the Public Keyfile Path if set otherwise it returns None This property returns False if a keyfile was provided, but was invalid
pub_keyfile
python
caronc/apprise
apprise/utils/pgp.py
https://github.com/caronc/apprise/blob/master/apprise/utils/pgp.py
BSD-2-Clause
def apply_template(template, app_mode=TemplateType.RAW, **kwargs): """ Takes a template in a str format and applies all of the keywords and their values to it. The app$mode is used to dictact any pre-processing that needs to take place to the escaped string prior to it being placed. The idea here ...
Takes a template in a str format and applies all of the keywords and their values to it. The app$mode is used to dictact any pre-processing that needs to take place to the escaped string prior to it being placed. The idea here is for elements to be placed in a JSON response for example should be ...
apply_template
python
caronc/apprise
apprise/utils/templates.py
https://github.com/caronc/apprise/blob/master/apprise/utils/templates.py
BSD-2-Clause
def no_throttling_everywhere(session_mocker): """ A pytest session fixture which disables throttling on all notifiers. It is automatically enabled. """ # Ensure we're working with a clean slate for each test N_MGR.unload_modules() C_MGR.unload_modules() A_MGR.unload_modules() for pl...
A pytest session fixture which disables throttling on all notifiers. It is automatically enabled.
no_throttling_everywhere
python
caronc/apprise
test/conftest.py
https://github.com/caronc/apprise/blob/master/test/conftest.py
BSD-2-Clause
def test_apprise_tagging_async(mock_post, mock_get): """ API: Apprise() object tagging functionality asynchronous methods """ with OuterEventLoop() as loop: def do_notify(server, *args, **kwargs): return loop.run_until_complete( server.async_notify(*args, **kwargs)) ...
API: Apprise() object tagging functionality asynchronous methods
test_apprise_tagging_async
python
caronc/apprise
test/test_api.py
https://github.com/caronc/apprise/blob/master/test/test_api.py
BSD-2-Clause
def test_apprise_attachment_truncate(mock_get): """ API: AppriseAttachment when truncation in place """ # Prepare our response response = requests.Request() response.status_code = requests.codes.ok # Prepare Mock mock_get.return_value = response # our Apprise Object ap_obj = ...
API: AppriseAttachment when truncation in place
test_apprise_attachment_truncate
python
caronc/apprise
test/test_apprise_attachments.py
https://github.com/caronc/apprise/blob/master/test/test_apprise_attachments.py
BSD-2-Clause