本文整理汇总了Python中DIRAC.Interfaces.API.DiracAdmin.DiracAdmin.sendSMS方法的典型用法代码示例。如果您正苦于以下问题:Python DiracAdmin.sendSMS方法的具体用法?Python DiracAdmin.sendSMS怎么用?Python DiracAdmin.sendSMS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.Interfaces.API.DiracAdmin.DiracAdmin
的用法示例。
在下文中一共展示了DiracAdmin.sendSMS方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _sendSMS
# 需要导入模块: from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin [as 别名]
# 或者: from DIRAC.Interfaces.API.DiracAdmin.DiracAdmin import sendSMS [as 别名]
def _sendSMS( self, text ):
from DIRAC.Interfaces.API.DiracAdmin import DiracAdmin
diracAdmin = DiracAdmin()
address = InfoGetter().getNotificationsThatApply( self.decissionParams, self.actionName )
if not address[ 'OK' ]:
return address
address = address[ 'Value' ]
for addressDict in address:
if not 'name' in addressDict:
return S_ERROR( 'Malformed address dict %s' % addressDict )
if not 'users' in addressDict:
return S_ERROR( 'Malformed address dict %s' % addressDict )
for user in addressDict[ 'users' ]:
# Where are the SMS numbers defined ?
resSMS = diracAdmin.sendSMS( user, text )
if not resSMS[ 'OK' ]:
return S_ERROR( 'Cannot send SMS to user "%s"' % user )
return resSMS
################################################################################
#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF