本文整理汇总了Python中sender.Sender.sendNotify方法的典型用法代码示例。如果您正苦于以下问题:Python Sender.sendNotify方法的具体用法?Python Sender.sendNotify怎么用?Python Sender.sendNotify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sender.Sender
的用法示例。
在下文中一共展示了Sender.sendNotify方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: changeNotifyTypeByBalance
# 需要导入模块: from sender import Sender [as 别名]
# 或者: from sender.Sender import sendNotify [as 别名]
def changeNotifyTypeByBalance(db):
"""
Принудительно изменяет тип оповещений с sms на емаил при балансе ниже нуля
О каждом изменении оповещает пользователя на смс и мыло
"""
from sender import Sender
accounts = db.getAccountsForChangeNotify()
logging.info("found %d account for change notify type" % len(accounts))
sender = Sender(db)
for account in accounts:
logging.info("process account %s" % account)
acc = db.getAccount(account['id'])
if acc is None:
logging.error('аккаунт не найден')
continue
#сменили тип нотификейшенов
res = db.setAccountNotify(acc['id'], 'email')
logging.debug("change type result %s" % res)
message = "%s: balance < 0, notify type change to email" % acc['login']
res1 = sender.sendNotify(acc, message, 'Notify type change by balance', 'sms')
res2 = sender.sendNotify(acc, message, 'Notify type change by balance', 'email')
logging.debug('result sms - %s; email - %s' % (res1, res2))
if res1 is not True or res2 is not True:
logging.error(res1)
logging.error(res2)
continue
logging.info('success notification of change notify type')
return len(accounts)
示例2: len
# 需要导入模块: from sender import Sender [as 别名]
# 或者: from sender.Sender import sendNotify [as 别名]
acc = db.getAccount(account['id'])
if acc is None:
logging.error('аккаунт не найден')
continue
#отвязали подсетку
res = db.unsetProxyNetworkForAccount(acc['id'])
logging.debug("unset proxy result %s" % res)
#выключили мониторинг всех игроков на аккаунте
res = db.disableMonitoringOnAccount(acc['id'])
logging.debug("disable monitoring result %s" % res)
message = "%s: proxy has expired, all checks stopped" % acc['login']
res1 = sender.sendNotify(acc, message, 'Proxy expired notify', 'sms')
res2 = sender.sendNotify(acc, message, 'Proxy expired notify', 'email')
logging.debug('result sms - %s; email - %s' % (res1, res2))
if res1 is not True or res2 is not True:
logging.error(res1)
logging.error(res2)
continue
logging.info('success notification of expired proxy')
#оповещение о скором освобождении прокси
accounts = db.getAccountsWithExpiredProxySoon()
logging.info("found %d account with proxy expire soon" % len(accounts))
for account in accounts:
logging.info("process account %s" % account)