provider.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:python-notifyAll 作者: inforian 项目源码 文件源码
def _validate_configure_twilio(self):
        """configure twilio client

        we will provide to ways to configure clients :
         - One, you can configure twilio keys from environment variables if not,
         - Then Second, you ca send keys as function arguments too,
         - Priority wil be given to function arguments

        :return: twilio client instance
        """

        if self.account_sid is None:
            self.account_sid = getattr(settings, 'TWILIO_ACCOUNT_SID', None)
        if self.auth_token is None:
            self.auth_token = getattr(settings, 'TWILIO_AUTH_TOKEN', None)

        if self.account_sid is None or self.auth_token is None:
            raise RuntimeWarning(
                'to send sms via {0} you need to configure TWILIO_ACCOUNT_SID & TWILIO_AUTH_TOKEN in \n'
                'environment variables or send account_sid & auth_token as function arguments.'.format(self.name)
            )

        self.twilio_client = TwilioRestClient(self.account_sid, self.auth_token)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号