当前位置: 首页>>代码示例>>Python>>正文


Python Sender.sendNotify方法代码示例

本文整理汇总了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)
开发者ID:esemi,项目名称:dsbot,代码行数:38,代码来源:notify_billing.py

示例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)
开发者ID:esemi,项目名称:dsbot,代码行数:31,代码来源:proxy_billing.py


注:本文中的sender.Sender.sendNotify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。