params.py 文件源码

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

项目:Tinychat-Bot--Discontinued 作者: Tinychat 项目源码 文件源码
def get_broadcast_token(self, nick, uid):
        """ Token required to start a broadcast.

        :param nick: Client nick name
        :type nick: str
        :param uid: Client user identification
        :type uid: str | int
        :return: The broadcast token required to start a broadcast or None on failure.
        :rtype: str | None
        """
        _url = self._broadcast_token_url.format(self.room_name, nick, uid)
        if self.is_greenroom:
            _url.replace('site=tinychat', 'site=greenroom')

        _response = util.web.http_get(url=_url, proxy=self.proxy)
        log.debug('broadcast token response: %s' % _response)
        if _response['content'] is not None:
            _xml = parseString(_response['content'])
            root = _xml.getElementsByTagName('response')[0]
            result = root.getAttribute('result')
            if result == 'PW':
                return result
            return root.getAttribute('token')
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号