本文整理匯總了Python中gntp.notifier.GrowlNotifier.subscribe方法的典型用法代碼示例。如果您正苦於以下問題:Python GrowlNotifier.subscribe方法的具體用法?Python GrowlNotifier.subscribe怎麽用?Python GrowlNotifier.subscribe使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gntp.notifier.GrowlNotifier
的用法示例。
在下文中一共展示了GrowlNotifier.subscribe方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_client
# 需要導入模塊: from gntp.notifier import GrowlNotifier [as 別名]
# 或者: from gntp.notifier.GrowlNotifier import subscribe [as 別名]
def test_client(config, options):
logging.basicConfig(level=options.verbose)
notifier = GrowlNotifier(
hostname=config.get('regrowl.server', 'hostname', '127.0.0.1'),
port=config.getint('regrowl.server', 'port'),
password=config.get('regrowl.server', 'password'),
notifications=['Test']
)
if options.test in ['registration', 'all']:
notifier.register()
if options.test in ['notification', 'all']:
notifier.notify(
noteType='Test',
title='Testing',
description='ReGrowl Test',
)
if options.test in ['subscription', 'all']:
notifier.subscribe(
'TestId',
'TestName',
1337,
)
示例2: GrowlNotifier
# 需要導入模塊: from gntp.notifier import GrowlNotifier [as 別名]
# 或者: from gntp.notifier.GrowlNotifier import subscribe [as 別名]
########NEW FILE########
__FILENAME__ = attributes
#!/usr/bin/env python
# Simple manual test to make sure that attributes do not
# accumulate in the base classes
# https://github.com/kfdm/gntp/issues/10
import gntp
import gntp.notifier
a = gntp.notifier.GrowlNotifier(notifications=['A'])
b = gntp.notifier.GrowlNotifier(notifications=['B'])
a.notify('A','A','A',sticky=True)
b.notify('B','B','B')
########NEW FILE########
__FILENAME__ = subscribe
# -*- coding: utf-8 -*-
# Simple script to test sending UTF8 text with the GrowlNotifier class
import logging
logging.basicConfig(level=logging.DEBUG)
from gntp.notifier import GrowlNotifier
import platform
growl = GrowlNotifier(notifications=['Testing'],password='password',hostname='ayu')
growl.subscribe(platform.node(),platform.node(),12345)
########NEW FILE########