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 url_parameters(self, *args, **kwargs): """ Provides a default set of args to work with. This can greatly simplify URL construction in the acommpanied url() function. The following property returns a dictionary (of strings) containing all of the parameters that can be set on ...
Provides a default set of args to work with. This can greatly simplify URL construction in the acommpanied url() function. The following property returns a dictionary (of strings) containing all of the parameters that can be set on a URL and managed through this class.
url_parameters
python
caronc/apprise
apprise/url.py
https://github.com/caronc/apprise/blob/master/apprise/url.py
BSD-2-Clause
def post_process_parse_url_results(results): """ After parsing the URL, this function applies a bit of extra logic to support extra entries like `pass` becoming `password`, etc This function assumes that parse_url() was called previously setting up the basics to be checked ...
After parsing the URL, this function applies a bit of extra logic to support extra entries like `pass` becoming `password`, etc This function assumes that parse_url() was called previously setting up the basics to be checked
post_process_parse_url_results
python
caronc/apprise
apprise/url.py
https://github.com/caronc/apprise/blob/master/apprise/url.py
BSD-2-Clause
def parse_url(url, verify_host=True, plus_to_space=False, strict_port=False, sanitize=True): """Parses the URL and returns it broken apart into a dictionary. This is very specific and customized for Apprise. Args: url (str): The URL you want to fully parse. ...
Parses the URL and returns it broken apart into a dictionary. This is very specific and customized for Apprise. Args: url (str): The URL you want to fully parse. verify_host (:obj:`bool`, optional): a flag kept with the parsed URL which some child classes will...
parse_url
python
caronc/apprise
apprise/url.py
https://github.com/caronc/apprise/blob/master/apprise/url.py
BSD-2-Clause
def http_response_code_lookup(code, response_mask=None): """Parses the interger response code returned by a remote call from a web request into it's human readable string version. You can over-ride codes or add new ones by providing your own response_mask that contains a dictionary of i...
Parses the interger response code returned by a remote call from a web request into it's human readable string version. You can over-ride codes or add new ones by providing your own response_mask that contains a dictionary of integer -> string mapped variables
http_response_code_lookup
python
caronc/apprise
apprise/url.py
https://github.com/caronc/apprise/blob/master/apprise/url.py
BSD-2-Clause
def schemas(self): """A simple function that returns a set of all schemas associated with this object based on the object.protocol and object.secure_protocol """ schemas = set([]) for key in ('protocol', 'secure_protocol'): schema = getattr(self, key, None) ...
A simple function that returns a set of all schemas associated with this object based on the object.protocol and object.secure_protocol
schemas
python
caronc/apprise
apprise/url.py
https://github.com/caronc/apprise/blob/master/apprise/url.py
BSD-2-Clause
def __init__(self, name=None, mimetype=None, cache=None, **kwargs): """ Initialize some general logging and common server arguments that will keep things consistent when working with the configurations that inherit this class. Optionally provide a filename to over-ride name asso...
Initialize some general logging and common server arguments that will keep things consistent when working with the configurations that inherit this class. Optionally provide a filename to over-ride name associated with the actual file retrieved (from where-ever). The m...
__init__
python
caronc/apprise
apprise/attachment/base.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/base.py
BSD-2-Clause
def path(self): """ Returns the absolute path to the filename. If this is not known or is know but has been considered expired (due to cache setting), then content is re-retrieved prior to returning. """ if not self.exists(): # we could not obtain our path ...
Returns the absolute path to the filename. If this is not known or is know but has been considered expired (due to cache setting), then content is re-retrieved prior to returning.
path
python
caronc/apprise
apprise/attachment/base.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/base.py
BSD-2-Clause
def mimetype(self): """ Returns mime type (if one is present). Content is cached once determied to prevent overhead of future calls. """ if not self.exists(): # we could not obtain our attachment return None if self._mimetype: ...
Returns mime type (if one is present). Content is cached once determied to prevent overhead of future calls.
mimetype
python
caronc/apprise
apprise/attachment/base.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/base.py
BSD-2-Clause
def exists(self, retrieve_if_missing=True): """ Simply returns true if the object has downloaded and stored the attachment AND the attachment has not expired. """ if self.location == ContentLocation.INACCESSIBLE: # our content is inaccessible return False ...
Simply returns true if the object has downloaded and stored the attachment AND the attachment has not expired.
exists
python
caronc/apprise
apprise/attachment/base.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/base.py
BSD-2-Clause
def base64(self, encoding='ascii'): """ Returns the attachment object as a base64 string otherwise None is returned if an error occurs. If encoding is set to None, then it is not encoded when returned """ if not self: # We could not access the attachment ...
Returns the attachment object as a base64 string otherwise None is returned if an error occurs. If encoding is set to None, then it is not encoded when returned
base64
python
caronc/apprise
apprise/attachment/base.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/base.py
BSD-2-Clause
def invalidate(self): """ Release any temporary data that may be open by child classes. Externally fetched content should be automatically cleaned up when this function is called. This function should also reset the following entries to None: - detected_name : Should i...
Release any temporary data that may be open by child classes. Externally fetched content should be automatically cleaned up when this function is called. This function should also reset the following entries to None: - detected_name : Should identify a human readable filename...
invalidate
python
caronc/apprise
apprise/attachment/base.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/base.py
BSD-2-Clause
def download(self): """ This function must be over-ridden by inheriting classes. Inherited classes MUST populate: - detected_name: Should identify a human readable filename - download_path: Must contain a absolute path to content - detected_mimetype: Should identif...
This function must be over-ridden by inheriting classes. Inherited classes MUST populate: - detected_name: Should identify a human readable filename - download_path: Must contain a absolute path to content - detected_mimetype: Should identify mimetype of content ...
download
python
caronc/apprise
apprise/attachment/base.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/base.py
BSD-2-Clause
def open(self, mode='rb'): """ return our file pointer and track it (we'll auto close later) """ pointer = open(self.path, mode=mode) self.__pointers.add(pointer) return pointer
return our file pointer and track it (we'll auto close later)
open
python
caronc/apprise
apprise/attachment/base.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/base.py
BSD-2-Clause
def chunk(self, size=5242880): """ A Generator that yield chunks of a file with the specified size. By default the chunk size is set to 5MB (5242880 bytes) """ with self.open() as file: while True: chunk = file.read(size) if not chunk...
A Generator that yield chunks of a file with the specified size. By default the chunk size is set to 5MB (5242880 bytes)
chunk
python
caronc/apprise
apprise/attachment/base.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/base.py
BSD-2-Clause
def parse_url(url, verify_host=True, mimetype_db=None, sanitize=True): """Parses the URL and returns it broken apart into a dictionary. This is very specific and customized for Apprise. Args: url (str): The URL you want to fully parse. verify_host (:obj:`bool`, optional...
Parses the URL and returns it broken apart into a dictionary. This is very specific and customized for Apprise. Args: url (str): The URL you want to fully parse. verify_host (:obj:`bool`, optional): a flag kept with the parsed URL which some child classes will ...
parse_url
python
caronc/apprise
apprise/attachment/base.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/base.py
BSD-2-Clause
def __len__(self): """ Returns the filesize of the attachment. """ if not self: return 0 try: return os.path.getsize(self.path) if self.path else 0 except OSError: # OSError can occur if the file is inaccessible return 0
Returns the filesize of the attachment.
__len__
python
caronc/apprise
apprise/attachment/base.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/base.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._mimetype: # A mime-type was enforced params['mime'] = self._mimetype ...
Returns the URL built dynamically based on specified arguments.
url
python
caronc/apprise
apprise/attachment/file.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/file.py
BSD-2-Clause
def download(self, **kwargs): """ Perform retrieval of our data. For file base attachments, our data already exists, so we only need to validate it. """ if self.location == ContentLocation.INACCESSIBLE: # our content is inaccessible return False ...
Perform retrieval of our data. For file base attachments, our data already exists, so we only need to validate it.
download
python
caronc/apprise
apprise/attachment/file.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/file.py
BSD-2-Clause
def parse_url(url): """ Parses the URL so that we can handle all different file paths and return it as our path object """ results = AttachBase.parse_url(url, verify_host=False) if not results: # We're done early; it's not a good URL return resul...
Parses the URL so that we can handle all different file paths and return it as our path object
parse_url
python
caronc/apprise
apprise/attachment/file.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/file.py
BSD-2-Clause
def __init__(self, headers=None, **kwargs): """ Initialize HTTP 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) self.schema = 'https' if self.s...
Initialize HTTP 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/attachment/http.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/http.py
BSD-2-Clause
def download(self, **kwargs): """ Perform retrieval of the configuration based on the specified request """ if self.location == ContentLocation.INACCESSIBLE: # our content is inaccessible return False # prepare header headers = { 'Use...
Perform retrieval of the configuration based on the specified request
download
python
caronc/apprise
apprise/attachment/http.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/http.py
BSD-2-Clause
def parse_url(url): """ Parses the URL and returns enough arguments that can allow us to re-instantiate this object. """ results = AttachBase.parse_url(url, sanitize=False) if not results: # We're done early as we couldn't load the results return ...
Parses the URL and returns enough arguments that can allow us to re-instantiate this object.
parse_url
python
caronc/apprise
apprise/attachment/http.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/http.py
BSD-2-Clause
def base64(self, encoding='ascii'): """ We need to over-ride this since the base64 sub-library seems to close our file descriptor making it no longer referencable. """ if not self: # We could not access the attachment self.logger.error( 'C...
We need to over-ride this since the base64 sub-library seems to close our file descriptor making it no longer referencable.
base64
python
caronc/apprise
apprise/attachment/memory.py
https://github.com/caronc/apprise/blob/master/apprise/attachment/memory.py
BSD-2-Clause
def servers(self, asset=None, **kwargs): """ Performs reads loaded configuration and returns all of the services that could be parsed and loaded. """ if not self.expired(): # We already have cached results to return; use them return self._cached_servers ...
Performs reads loaded configuration and returns all of the services that could be parsed and loaded.
servers
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def expired(self): """ Simply returns True if the configuration should be considered as expired or False if content should be retrieved. """ if isinstance(self._cached_servers, list) and self.cache: # We have enough reason to look further into our cached content ...
Simply returns True if the configuration should be considered as expired or False if content should be retrieved.
expired
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def __normalize_tag_groups(group_tags): """ Used to normalize a tag assign map which looks like: { 'group': set('{tag1}', '{group1}', '{tag2}'), 'group1': set('{tag2}','{tag3}'), } Then normalized it (merging groups); with respect to the above, th...
Used to normalize a tag assign map which looks like: { 'group': set('{tag1}', '{group1}', '{tag2}'), 'group1': set('{tag2}','{tag3}'), } Then normalized it (merging groups); with respect to the above, the output would be: { ...
__normalize_tag_groups
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def _expand(tags, ignore=None): """ Expands based on tag provided and returns a set this also updates the group_tags while it goes """ # Prepare ourselves a return set results = set() ignore = set() if ignore is None else ignore ...
Expands based on tag provided and returns a set this also updates the group_tags while it goes
_expand
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def detect_config_format(content, **kwargs): """ Takes the specified content and attempts to detect the format type The function returns the actual format type if detected, otherwise it returns None """ # Detect Format Logic: # - A pound/hashtag (#) is alawys a...
Takes the specified content and attempts to detect the format type The function returns the actual format type if detected, otherwise it returns None
detect_config_format
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def config_parse(content, asset=None, config_format=None, **kwargs): """ Takes the specified config content and loads it based on the specified config_format. If a format isn't specified, then it is auto detected. """ if config_format is None: # Detect the format ...
Takes the specified config content and loads it based on the specified config_format. If a format isn't specified, then it is auto detected.
config_parse
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def config_parse_text(content, asset=None): """ Parse the specified content as though it were a simple text file only containing a list of URLs. Return a tuple that looks like (servers, configs) where: - servers contains a list of loaded notification plugins - config...
Parse the specified content as though it were a simple text file only containing a list of URLs. Return a tuple that looks like (servers, configs) where: - servers contains a list of loaded notification plugins - configs contains a list of additional configuration files ...
config_parse_text
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def config_parse_yaml(content, asset=None): """ Parse the specified content as though it were a yaml file specifically formatted for Apprise. Return a tuple that looks like (servers, configs) where: - servers contains a list of loaded notification plugins - configs c...
Parse the specified content as though it were a yaml file specifically formatted for Apprise. Return a tuple that looks like (servers, configs) where: - servers contains a list of loaded notification plugins - configs contains a list of additional configuration files ...
config_parse_yaml
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def pop(self, index=-1): """ Removes an indexed Notification Service from the stack and returns it. By default, the last element of the list is removed. """ if not isinstance(self._cached_servers, list): # Generate ourselves a list of content we can pull from ...
Removes an indexed Notification Service from the stack and returns it. By default, the last element of the list is removed.
pop
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def _special_token_handler(schema, tokens): """ This function takes a list of tokens and updates them to no longer include any special tokens such as +,-, and : - schema must be a valid schema of a supported plugin type - tokens must be a dictionary containing the yaml entries p...
This function takes a list of tokens and updates them to no longer include any special tokens such as +,-, and : - schema must be a valid schema of a supported plugin type - tokens must be a dictionary containing the yaml entries parsed. The idea here is we can post process a ...
_special_token_handler
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def __getitem__(self, index): """ Returns the indexed server entry associated with the loaded notification servers """ if not isinstance(self._cached_servers, list): # Generate ourselves a list of content we can pull from self.servers() return sel...
Returns the indexed server entry associated with the loaded notification servers
__getitem__
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def __iter__(self): """ Returns an iterator to our server list """ if not isinstance(self._cached_servers, list): # Generate ourselves a list of content we can pull from self.servers() return iter(self._cached_servers)
Returns an iterator to our server list
__iter__
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def __len__(self): """ Returns the total number of servers loaded """ if not isinstance(self._cached_servers, list): # Generate ourselves a list of content we can pull from self.servers() return len(self._cached_servers)
Returns the total number of servers loaded
__len__
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def __bool__(self): """ Allows the Apprise object to be wrapped in an 'if statement'. True is returned if our content was downloaded correctly. """ if not isinstance(self._cached_servers, list): # Generate ourselves a list of content we can pull from self....
Allows the Apprise object to be wrapped in an 'if statement'. True is returned if our content was downloaded correctly.
__bool__
python
caronc/apprise
apprise/config/base.py
https://github.com/caronc/apprise/blob/master/apprise/config/base.py
BSD-2-Clause
def __init__(self, path, **kwargs): """ Initialize File 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) # Store our file path as it was set ...
Initialize File 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/config/file.py
https://github.com/caronc/apprise/blob/master/apprise/config/file.py
BSD-2-Clause
def __init__(self, content, **kwargs): """ Initialize Memory Object Memory objects just store the raw configuration in memory. There is no external reference point. It's always considered cached. """ super().__init__(**kwargs) # Store our raw config into memory...
Initialize Memory Object Memory objects just store the raw configuration in memory. There is no external reference point. It's always considered cached.
__init__
python
caronc/apprise
apprise/config/memory.py
https://github.com/caronc/apprise/blob/master/apprise/config/memory.py
BSD-2-Clause
def instantiate_plugin(url, send_func, name=None): """ The function used to add a new notification plugin based on the schema parsed from the provided URL into our supported matrix structure. """ if not isinstance(url, str): msg = 'An invalid custom notify url/schema...
The function used to add a new notification plugin based on the schema parsed from the provided URL into our supported matrix structure.
instantiate_plugin
python
caronc/apprise
apprise/decorators/base.py
https://github.com/caronc/apprise/blob/master/apprise/decorators/base.py
BSD-2-Clause
def send(self, body, title='', notify_type=common.NotifyType.INFO, *args, **kwargs): """ Our send() call which triggers our hook """ response = False try: # Enforce a boolean response ...
Our send() call which triggers our hook
send
python
caronc/apprise
apprise/decorators/base.py
https://github.com/caronc/apprise/blob/master/apprise/decorators/base.py
BSD-2-Clause
def notify(on, name=None): """ @notify decorator allows you to map functions you've defined to be loaded as a regular notify by Apprise. You must identify a protocol that users will trigger your call by. @notify(on="foobar") def your_declaration(body, title, notify_type, meta, *args, *...
@notify decorator allows you to map functions you've defined to be loaded as a regular notify by Apprise. You must identify a protocol that users will trigger your call by. @notify(on="foobar") def your_declaration(body, title, notify_type, meta, *args, **kwargs): ... You...
notify
python
caronc/apprise
apprise/decorators/notify.py
https://github.com/caronc/apprise/blob/master/apprise/decorators/notify.py
BSD-2-Clause
def __len__(self): """ Returns the number of targets associated with this notification """ # # Factor batch into calculation # batch_size = 1 if not self.batch else self.default_batch_size targets = len(self.targets) if batch_size > 1: ...
Returns the number of targets associated with this notification
__len__
python
caronc/apprise
apprise/plugins/africas_talking.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/africas_talking.py
BSD-2-Clause
def __init__(self, token=None, tags=None, method=None, headers=None, **kwargs): """ Initialize Apprise API 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()...
Initialize Apprise API 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/apprise_api.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/apprise_api.py
BSD-2-Clause
def parse_native_url(url): """ Support http://hostname/notify/token and http://hostname/path/notify/token """ result = re.match( r'^http(?P<secure>s?)://(?P<hostname>[A-Z0-9._-]+)' r'(:(?P<port>[0-9]+))?' r'(?P<path>/[^?]+?)?/notify/(?...
Support http://hostname/notify/token and http://hostname/path/notify/token
parse_native_url
python
caronc/apprise
apprise/plugins/apprise_api.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/apprise_api.py
BSD-2-Clause
def socket_close(self): """ Closes the socket connection whereas present """ if self.sock: try: self.sock.close() except Exception: # No worries if socket exception thrown on close() pass self.sock = No...
Closes the socket connection whereas present
socket_close
python
caronc/apprise
apprise/plugins/aprs.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/aprs.py
BSD-2-Clause
def socket_open(self): """ Establishes the connection to the APRS-IS socket server """ self.logger.debug( "Creating socket connection with APRS-IS {}:{}".format( APRS_LOCALES[self.locale], self.notify_port ) ) try: ...
Establishes the connection to the APRS-IS socket server
socket_open
python
caronc/apprise
apprise/plugins/aprs.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/aprs.py
BSD-2-Clause
def aprsis_login(self): """ Generate the APRS-IS login string, send it to the server and parse the response Returns True/False wrt whether the login was successful """ self.logger.debug("socket_login: init") # Check if we are connected if not self.sock: ...
Generate the APRS-IS login string, send it to the server and parse the response Returns True/False wrt whether the login was successful
aprsis_login
python
caronc/apprise
apprise/plugins/aprs.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/aprs.py
BSD-2-Clause
def url_identifier(self): """ Returns all of the identifiers that make this URL unique from another simliar 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 simliar one. Targets or end points should never be identified here.
url_identifier
python
caronc/apprise
apprise/plugins/bark.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/bark.py
BSD-2-Clause
def __init__(self, **kwargs): """ Initialize some general configuration that will keep things consistent when working with the notifiers that will inherit this class. """ super().__init__(**kwargs) # Store our interpret_emoji's setting # If asset emoji value is...
Initialize some general configuration that will keep things consistent when working with the notifiers that will inherit this class.
__init__
python
caronc/apprise
apprise/plugins/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/base.py
BSD-2-Clause
def image_path(self, notify_type, extension=None): """ Returns the path of the image if it can """ if not self.image_size: return None if notify_type not in NOTIFY_TYPES: return None return self.asset.image_path( notify_type=notify_ty...
Returns the path of the image if it can
image_path
python
caronc/apprise
apprise/plugins/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/base.py
BSD-2-Clause
def image_raw(self, notify_type, extension=None): """ Returns the raw image if it can """ if not self.image_size: return None if notify_type not in NOTIFY_TYPES: return None return self.asset.image_raw( notify_type=notify_type, ...
Returns the raw image if it can
image_raw
python
caronc/apprise
apprise/plugins/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/base.py
BSD-2-Clause
def color(self, notify_type, color_type=None): """ Returns the html color (hex code) associated with the notify_type """ if notify_type not in NOTIFY_TYPES: return None return self.asset.color( notify_type=notify_type, color_type=color_type, ...
Returns the html color (hex code) associated with the notify_type
color
python
caronc/apprise
apprise/plugins/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/base.py
BSD-2-Clause
def ascii(self, notify_type): """ Returns the ascii characters associated with the notify_type """ if notify_type not in NOTIFY_TYPES: return None return self.asset.ascii( notify_type=notify_type, )
Returns the ascii characters associated with the notify_type
ascii
python
caronc/apprise
apprise/plugins/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/base.py
BSD-2-Clause
def _build_send_calls(self, body=None, title=None, notify_type=NotifyType.INFO, overflow=None, attach=None, body_format=None, **kwargs): """ Get a list of dictionaries that can be used to call send() or (in the future) async_send(). """...
Get a list of dictionaries that can be used to call send() or (in the future) async_send().
_build_send_calls
python
caronc/apprise
apprise/plugins/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/base.py
BSD-2-Clause
def _apply_overflow(self, body, title=None, overflow=None, body_format=None): """ Takes the message body and title as input. This function then applies any defined overflow restrictions associated with the notification service and may alter the message if/as requ...
Takes the message body and title as input. This function then applies any defined overflow restrictions associated with the notification service and may alter the message if/as required. The function will always return a list object in the following structure: [ ...
_apply_overflow
python
caronc/apprise
apprise/plugins/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/base.py
BSD-2-Clause
def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """ Should preform the actual notification itself. """ raise NotImplementedError( "send() is not implimented by the child class.")
Should preform the actual notification itself.
send
python
caronc/apprise
apprise/plugins/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/base.py
BSD-2-Clause
def url_parameters(self, *args, **kwargs): """ Provides a default set of parameters to work with. This can greatly simplify URL construction in the acommpanied url() function in all defined plugin services. """ params = { 'format': self.notify_format, ...
Provides a default set of parameters to work with. This can greatly simplify URL construction in the acommpanied url() function in all defined plugin services.
url_parameters
python
caronc/apprise
apprise/plugins/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/base.py
BSD-2-Clause
def store(self): """ Returns a pointer to our persistent store for use. The best use cases are: self.store.get('key') self.store.set('key', 'value') self.store.delete('key1', 'key2', ...) You can also access the keys this way: self.store[...
Returns a pointer to our persistent store for use. The best use cases are: self.store.get('key') self.store.set('key', 'value') self.store.delete('key1', 'key2', ...) You can also access the keys this way: self.store['key'] And clear ...
store
python
caronc/apprise
apprise/plugins/base.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/base.py
BSD-2-Clause
def get_identifier(self, user=None, login=False): """ Performs a Decentralized User Lookup and returns the identifier """ if user is None: user = self.user user = f'{user}.{self.host}' if '.' not in user else f'{user}' key = f'did.{user}' did = self....
Performs a Decentralized User Lookup and returns the identifier
get_identifier
python
caronc/apprise
apprise/plugins/bluesky.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/bluesky.py
BSD-2-Clause
def login(self): """ A simple wrapper to authenticate with the BlueSky Server """ # Acquire our Decentralized Identitifer did = self.get_identifier(self.user, login=True) if not did: return False url = f'https://{self.host}{self.xrpc_suffix_session}'...
A simple wrapper to authenticate with the BlueSky Server
login
python
caronc/apprise
apprise/plugins/bluesky.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/bluesky.py
BSD-2-Clause
def _fetch(self, url, payload=None, params=None, method='POST', content_type=None, login=False): """ Wrapper to BlueSky API requests object """ # use what was specified, otherwise build headers dynamically headers = { 'User-Agent': self.app_id, ...
Wrapper to BlueSky API requests object
_fetch
python
caronc/apprise
apprise/plugins/bluesky.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/bluesky.py
BSD-2-Clause
def __init__(self, headers=None, method=None, payload=None, params=None, attach_as=None, **kwargs): """ Initialize Form 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 Form 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/custom_form.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/custom_form.py
BSD-2-Clause
def __init__(self, headers=None, method=None, payload=None, params=None, **kwargs): """ Initialize JSON 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().__...
Initialize JSON 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/custom_json.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/custom_json.py
BSD-2-Clause
def __init__(self, headers=None, method=None, payload=None, params=None, **kwargs): """ Initialize XML 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().__i...
Initialize XML 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/custom_xml.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/custom_xml.py
BSD-2-Clause
def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """ Depending on whether we are set to batch mode or single mode this redirects to the appropriate handling """ if len(self.targets) == 0: # There were no services to notify self.logge...
Depending on whether we are set to batch mode or single mode this redirects to the appropriate handling
send
python
caronc/apprise
apprise/plugins/d7networks.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/d7networks.py
BSD-2-Clause
def parse_url(url): """ There are no parameters nessisary for this protocol; simply having gnome:// is all you need. This function just makes sure that is in place. """ results = NotifyBase.parse_url(url, verify_host=False) # Include images with our message ...
There are no parameters nessisary for this protocol; simply having gnome:// is all you need. This function just makes sure that is in place.
parse_url
python
caronc/apprise
apprise/plugins/dbus.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/dbus.py
BSD-2-Clause
def get_signature(self): """ Calculates time-based signature so that we can send arbitrary messages. """ timestamp = str(round(time.time() * 1000)) secret_enc = self.secret.encode('utf-8') str_to_sign_enc = \ "{}\n{}".format(timestamp, self.secret).encode('utf...
Calculates time-based signature so that we can send arbitrary messages.
get_signature
python
caronc/apprise
apprise/plugins/dingtalk.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/dingtalk.py
BSD-2-Clause
def title_maxlen(self): """ The title isn't used when not in markdown mode. """ return NotifyBase.title_maxlen \ if self.notify_format == NotifyFormat.MARKDOWN else 0
The title isn't used when not in markdown mode.
title_maxlen
python
caronc/apprise
apprise/plugins/dingtalk.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/dingtalk.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 load the results return...
Parses the URL and returns enough arguments that can allow us to substantiate this object.
parse_url
python
caronc/apprise
apprise/plugins/dingtalk.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/dingtalk.py
BSD-2-Clause
def _send(self, payload, attach=None, params=None, rate_limit=1, **kwargs): """ Wrapper to the requests (post) object """ # Our headers headers = { 'User-Agent': self.app_id, } # Construct Notify URL notify_url = '{0}/{1}/{2}'.f...
Wrapper to the requests (post) object
_send
python
caronc/apprise
apprise/plugins/discord.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/discord.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: discord://webhook_id/webhook_token """ results = NotifyBase.parse_url(url, verify_host=False) if not results: # We'...
Parses the URL and returns enough arguments that can allow us to re-instantiate this object. Syntax: discord://webhook_id/webhook_token
parse_url
python
caronc/apprise
apprise/plugins/discord.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/discord.py
BSD-2-Clause
def parse_native_url(url): """ Support https://discord.com/api/webhooks/WEBHOOK_ID/WEBHOOK_TOKEN Support Legacy URL as well: https://discordapp.com/api/webhooks/WEBHOOK_ID/WEBHOOK_TOKEN """ result = re.match( r'^https?://discord(app)?\.com/api/webhooks/' ...
Support https://discord.com/api/webhooks/WEBHOOK_ID/WEBHOOK_TOKEN Support Legacy URL as well: https://discordapp.com/api/webhooks/WEBHOOK_ID/WEBHOOK_TOKEN
parse_native_url
python
caronc/apprise
apprise/plugins/discord.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/discord.py
BSD-2-Clause
def extract_markdown_sections(markdown): """ Takes a string in a markdown type format and extracts the headers and their corresponding sections into individual fields that get passed as an embed entry to Discord. """ # Search for any header information found without it's...
Takes a string in a markdown type format and extracts the headers and their corresponding sections into individual fields that get passed as an embed entry to Discord.
extract_markdown_sections
python
caronc/apprise
apprise/plugins/discord.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/discord.py
BSD-2-Clause
def login(self, **kwargs): """ Creates our authentication token and prepares our header """ if self.is_authenticated: # Log out first before we log back in self.logout() # Prepare our login url url = '%s://%s' % (self.schema, self.host) ...
Creates our authentication token and prepares our header
login
python
caronc/apprise
apprise/plugins/emby.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/emby.py
BSD-2-Clause
def sessions(self, user_controlled=True): """ Acquire our Session Identifiers and store them in a dictionary indexed by the session id itself. """ # A single session might look like this: # { # u'AdditionalUsers': [], # u'ApplicationVersion': u'3.3....
Acquire our Session Identifiers and store them in a dictionary indexed by the session id itself.
sessions
python
caronc/apprise
apprise/plugins/emby.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/emby.py
BSD-2-Clause
def logout(self, **kwargs): """ Logs out of an already-authenticated session """ if not self.is_authenticated: # We're not authenticated; there is nothing to do return True # Prepare our login url url = '%s://%s' % (self.schema, self.host) ...
Logs out of an already-authenticated session
logout
python
caronc/apprise
apprise/plugins/emby.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/emby.py
BSD-2-Clause
def emby_auth_header(self): """ Generates the X-Emby-Authorization header response based on whether we're authenticated or not. """ # Specific to Emby header_args = [ ('MediaBrowser Client', self.app_id), ('Device', self.app_id), ('Dev...
Generates the X-Emby-Authorization header response based on whether we're authenticated or not.
emby_auth_header
python
caronc/apprise
apprise/plugins/emby.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/emby.py
BSD-2-Clause
def __init__(self, timeout=None, headers=None, **kwargs): """ Initialize Enigma2 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) try: ...
Initialize Enigma2 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/enigma2.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/enigma2.py
BSD-2-Clause
def parse_url(url): """ Parses the URL and returns enough arguments that can allow us to re-instantiate this object. """ results = NotifyBase.parse_url(url, verify_host=False) if not results: # We're done early as we couldn't load the results retur...
Parses the URL and returns enough arguments that can allow us to re-instantiate this object.
parse_url
python
caronc/apprise
apprise/plugins/flock.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/flock.py
BSD-2-Clause
def parse_native_url(url): """ Support https://api.flock.com/hooks/sendMessage/TOKEN """ result = re.match( r'^https?://api\.flock\.com/hooks/sendMessage/' r'(?P<token>[a-z0-9-]{24})/?' r'(?P<params>\?.+)?$', url, re.I) if result: ...
Support https://api.flock.com/hooks/sendMessage/TOKEN
parse_native_url
python
caronc/apprise
apprise/plugins/flock.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/flock.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: gchat://workspace/webhook_key/webhook_token gchat://workspace/webhook_key/webhook_token/thread_key """ results = NotifyBase.p...
Parses the URL and returns enough arguments that can allow us to re-instantiate this object. Syntax: gchat://workspace/webhook_key/webhook_token gchat://workspace/webhook_key/webhook_token/thread_key
parse_url
python
caronc/apprise
apprise/plugins/google_chat.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/google_chat.py
BSD-2-Clause
def parse_native_url(url): """ Support https://chat.googleapis.com/v1/spaces/{workspace}/messages '?key={key}&token={token} https://chat.googleapis.com/v1/spaces/{workspace}/messages '?key={key}&token={token}&threadKey={thread} """ ...
Support https://chat.googleapis.com/v1/spaces/{workspace}/messages '?key={key}&token={token} https://chat.googleapis.com/v1/spaces/{workspace}/messages '?key={key}&token={token}&threadKey={thread}
parse_native_url
python
caronc/apprise
apprise/plugins/google_chat.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/google_chat.py
BSD-2-Clause
def parse_native_url(url): """ Support https://media.guilded.gg/webhooks/WEBHOOK_ID/WEBHOOK_TOKEN """ result = re.match( r'^https?://(media\.)?guilded\.gg/webhooks/' # a UUID, but we do we really need to be _that_ picky? r'(?P<webhook_id>[-0-9a-f]+)/'...
Support https://media.guilded.gg/webhooks/WEBHOOK_ID/WEBHOOK_TOKEN
parse_native_url
python
caronc/apprise
apprise/plugins/guilded.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/guilded.py
BSD-2-Clause
def __init__(self, webhook_id, events, add_tokens=None, del_tokens=None, **kwargs): """ Initialize IFTTT Object add_tokens can optionally be a dictionary of key/value pairs that you want to include in the IFTTT post to the server. del_tokens can optionally be a...
Initialize IFTTT Object add_tokens can optionally be a dictionary of key/value pairs that you want to include in the IFTTT post to the server. del_tokens can optionally be a list/tuple/set of tokens that you want to eliminate from the IFTTT post. There isn't much real...
__init__
python
caronc/apprise
apprise/plugins/ifttt.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/ifttt.py
BSD-2-Clause
def parse_native_url(url): """ Support https://maker.ifttt.com/use/WEBHOOK_ID/EVENT_ID """ result = re.match( r'^https?://maker\.ifttt\.com/use/' r'(?P<webhook_id>[A-Z0-9_-]+)' r'((?P<events>(/[A-Z0-9_-]+)+))?' r'/?(?P<params>\?.+)?$', url...
Support https://maker.ifttt.com/use/WEBHOOK_ID/EVENT_ID
parse_native_url
python
caronc/apprise
apprise/plugins/ifttt.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/ifttt.py
BSD-2-Clause
def sound_lookup(lookup): """ A simple match function that takes string and returns the LametricSound object it was found in. """ for x in LAMETRIC_SOUNDS: match = next((f for f in x[1] if f.startswith(lookup)), None) if match: # We're do...
A simple match function that takes string and returns the LametricSound object it was found in.
sound_lookup
python
caronc/apprise
apprise/plugins/lametric.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/lametric.py
BSD-2-Clause
def _cloud_notification_payload(self, body, notify_type, headers): """ Return URL and payload for cloud directed requests """ # Update header entries headers.update({ 'X-Access-Token': self.lametric_apikey, }) if self.sound: self.logger.w...
Return URL and payload for cloud directed requests
_cloud_notification_payload
python
caronc/apprise
apprise/plugins/lametric.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/lametric.py
BSD-2-Clause
def _device_notification_payload(self, body, notify_type, headers): """ Return URL and Payload for Device directed requests """ # Assign our icon if the user specified a custom one, otherwise # choose from our pre-set list (based on notify_type) icon = self.icon if self....
Return URL and Payload for Device directed requests
_device_notification_payload
python
caronc/apprise
apprise/plugins/lametric.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/lametric.py
BSD-2-Clause
def parse_native_url(url): """ Support https://developer.lametric.com/api/v1/dev/\ widget/update/com.lametric.{APP_ID}/1 https://developer.lametric.com/api/v1/dev/\ widget/update/com.lametric.{APP_ID}/{APP_VER} """ # If users ...
Support https://developer.lametric.com/api/v1/dev/ widget/update/com.lametric.{APP_ID}/1 https://developer.lametric.com/api/v1/dev/ widget/update/com.lametric.{APP_ID}/{APP_VER}
parse_native_url
python
caronc/apprise
apprise/plugins/lametric.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/lametric.py
BSD-2-Clause
def send(self, body, title='', notify_type=NotifyType.INFO, attach=None, **kwargs): """ wrapper to _send since we can alert more then one channel """ # Build a list of our attachments attachments = [] # Smart Target Detection for Direct Messages; this preve...
wrapper to _send since we can alert more then one channel
send
python
caronc/apprise
apprise/plugins/mastodon.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/mastodon.py
BSD-2-Clause
def _whoami(self, lazy=True): """ Looks details of current authenticated user """ if lazy and self._whoami_cache is not None: # Use cached response return self._whoami_cache # Send Mastodon Whoami request postokay, response = self._request( ...
Looks details of current authenticated user
_whoami
python
caronc/apprise
apprise/plugins/mastodon.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/mastodon.py
BSD-2-Clause
def _request(self, path, payload=None, method='POST'): """ Wrapper to Mastodon API requests object """ headers = { 'User-Agent': self.app_id, 'Authorization': f'Bearer {self.token}', } data = None files = None # Prepare our messa...
Wrapper to Mastodon API requests object
_request
python
caronc/apprise
apprise/plugins/mastodon.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/mastodon.py
BSD-2-Clause
def _slack_webhook_payload(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """ Format the payload for a Slack based message """ if not hasattr(self, '_re_slack_formatting_rules'): # Prepare some one-time slack formatting variable...
Format the payload for a Slack based message
_slack_webhook_payload
python
caronc/apprise
apprise/plugins/matrix.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/matrix.py
BSD-2-Clause
def _matrix_webhook_payload(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """ Format the payload for a Matrix based message """ payload = { 'displayName': self.user if self.user else self.app_id, 'f...
Format the payload for a Matrix based message
_matrix_webhook_payload
python
caronc/apprise
apprise/plugins/matrix.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/matrix.py
BSD-2-Clause
def _t2bot_webhook_payload(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """ Format the payload for a T2Bot Matrix based messages """ # Retrieve our payload payload = self._matrix_webhook_payload( body=body, title=title...
Format the payload for a T2Bot Matrix based messages
_t2bot_webhook_payload
python
caronc/apprise
apprise/plugins/matrix.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/matrix.py
BSD-2-Clause
def _send_server_notification(self, body, title='', notify_type=NotifyType.INFO, attach=None, **kwargs): """ Perform Direct Matrix Server Notification (no webhook) """ if self.access_token is None and self.password and ...
Perform Direct Matrix Server Notification (no webhook)
_send_server_notification
python
caronc/apprise
apprise/plugins/matrix.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/matrix.py
BSD-2-Clause
def _send_attachments(self, attach): """ Posts all of the provided attachments """ payloads = [] if self.version != MatrixVersion.V2: self.logger.warning( 'Add ?v=2 to Apprise URL to support Attachments') return next((False for a in attach...
Posts all of the provided attachments
_send_attachments
python
caronc/apprise
apprise/plugins/matrix.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/matrix.py
BSD-2-Clause
def _register(self): """ Register with the service if possible. """ # Prepare our Registration Payload. This will only work if registration # is enabled for the public payload = { 'kind': 'user', 'auth': {'type': 'm.login.dummy'}, } ...
Register with the service if possible.
_register
python
caronc/apprise
apprise/plugins/matrix.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/matrix.py
BSD-2-Clause
def _login(self): """ Acquires the matrix token required for making future requests. If we fail we return False, otherwise we return True """ if self.access_token: # Login not required; silently skip-over return True if (self.user and self.passwo...
Acquires the matrix token required for making future requests. If we fail we return False, otherwise we return True
_login
python
caronc/apprise
apprise/plugins/matrix.py
https://github.com/caronc/apprise/blob/master/apprise/plugins/matrix.py
BSD-2-Clause