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


Python Subscriber.authorized方法代码示例

本文整理汇总了Python中subscriber.Subscriber.authorized方法的典型用法代码示例。如果您正苦于以下问题:Python Subscriber.authorized方法的具体用法?Python Subscriber.authorized怎么用?Python Subscriber.authorized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在subscriber.Subscriber的用法示例。


在下文中一共展示了Subscriber.authorized方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: deactivate_subscriptions

# 需要导入模块: from subscriber import Subscriber [as 别名]
# 或者: from subscriber.Subscriber import authorized [as 别名]
 def deactivate_subscriptions(self, msg):
     try:
         sms = SMS()
         sub = Subscriber()
         cur = db_conn.cursor()
         cur.execute('SELECT msisdn FROM subscribers WHERE subscription_status = 0')
         count = cur.rowcount
         if count > 0:
             self.logger.info('Found %d subscribers to be deactivated' % count)
             subscribers_list = cur.fetchall()
             for mysub in subscribers_list:
                 self.logger.debug('Send SMS that account is deactivated to %s' % mysub[0])
                 sms.send(config['smsc'],mysub[0], msg)
                 # disable subscriber
                 try:
                     sub.authorized(mysub[0], 0)
                 except SubscriberException as e:
                     raise SubscriptionException('PG_HLR error in deactivating subscription: %s' % e)
         else:
             self.logger.info('No subscribers need to be deactivate')
     except psycopg2.DatabaseError as e:
         raise SubscriptionException('PG_HLR error in checking subscriptions to deactivate: %s' % e)
开发者ID:ciaby,项目名称:rccn,代码行数:24,代码来源:subscription.py


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