本文整理汇总了Python中apprise.AppriseAsset方法的典型用法代码示例。如果您正苦于以下问题:Python apprise.AppriseAsset方法的具体用法?Python apprise.AppriseAsset怎么用?Python apprise.AppriseAsset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apprise
的用法示例。
在下文中一共展示了apprise.AppriseAsset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_apprise
# 需要导入模块: import apprise [as 别名]
# 或者: from apprise import AppriseAsset [as 别名]
def build_apprise(self):
asset = apprise.AppriseAsset(
image_url_mask='https://i.imgur.com/L40ksWY.png',
default_extension='.png'
)
asset.app_id = "Ouroboros"
asset.app_desc = "Ouroboros"
asset.app_url = "https://github.com/pyouroboros/ouroboros"
asset.html_notify_map['info'] = '#5F87C6'
asset.image_url_logo = 'https://bin.cajun.pro/images/ouroboros/notifications/ouroboros-logo-256x256.png'
apprise_obj = apprise.Apprise(asset=asset)
for notifier in self.config.notifiers:
add = apprise_obj.add(notifier)
if not add:
self.logger.error('Could not add notifier %s', notifier)
return apprise_obj
示例2: build_apprise
# 需要导入模块: import apprise [as 别名]
# 或者: from apprise import AppriseAsset [as 别名]
def build_apprise(self, notifiers):
asset = apprise.AppriseAsset()
asset.app_id = "dockupdater"
asset.app_desc = "dockupdater"
asset.app_url = "https://github.com/dockupdater/dockupdater"
asset.html_notify_map['info'] = '#5F87C6'
apprise_obj = apprise.Apprise(asset=asset)
for notifier in notifiers:
if notifier:
add = apprise_obj.add(notifier)
if not add:
self.logger.error('Could not add notifier %s', notifier)
return apprise_obj
示例3: test_apprise_config_tagging
# 需要导入模块: import apprise [as 别名]
# 或者: from apprise import AppriseAsset [as 别名]
def test_apprise_config_tagging(tmpdir):
"""
API: AppriseConfig tagging
"""
# temporary file to work with
t = tmpdir.mkdir("tagging").join("apprise")
buf = "gnome://"
t.write(buf)
# Create ourselves a config object
ac = AppriseConfig()
# Add an item associated with tag a
assert ac.add(configs=str(t), asset=AppriseAsset(), tag='a') is True
# Add an item associated with tag b
assert ac.add(configs=str(t), asset=AppriseAsset(), tag='b') is True
# Add an item associated with tag a or b
assert ac.add(configs=str(t), asset=AppriseAsset(), tag='a,b') is True
# Now filter: a:
assert len(ac.servers(tag='a')) == 2
# Now filter: a or b:
assert len(ac.servers(tag='a,b')) == 3
# Now filter: a and b
assert len(ac.servers(tag=[('a', 'b')])) == 1
# all matches everything
assert len(ac.servers(tag='all')) == 3
示例4: test_apprise_add_config
# 需要导入模块: import apprise [as 别名]
# 或者: from apprise import AppriseAsset [as 别名]
def test_apprise_add_config():
"""
API AppriseConfig.add_config()
"""
content = """
# A comment line over top of a URL
mailto://usera:pass@gmail.com
# A line with mulitiple tag assignments to it
taga,tagb=gnome://
# Event if there is accidental leading spaces, this configuation
# is accepting of htat and will not exclude them
tagc=kde://
# A very poorly structured url
sns://:@/
# Just 1 token provided causes exception
sns://T1JJ3T3L2/
"""
# Create ourselves a config object
ac = AppriseConfig()
assert ac.add_config(content=content)
# One configuration file should have been found
assert len(ac) == 1
# Object can be directly checked as a boolean; response is True
# when there is at least one entry
assert ac
# We should be able to read our 3 servers from that
assert len(ac.servers()) == 3
# Get our URL back
assert isinstance(ac[0].url(), six.string_types)
# Test invalid content
assert ac.add_config(content=object()) is False
assert ac.add_config(content=42) is False
assert ac.add_config(content=None) is False
# Still only one server loaded
assert len(ac) == 1
# Test having a pre-defined asset object and tag created
assert ac.add_config(
content=content, asset=AppriseAsset(), tag='a') is True
# Now there are 2 servers loaded
assert len(ac) == 2
# and 6 urls.. (as we've doubled up)
assert len(ac.servers()) == 6