brightcove.py 文件源码

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

项目:xblock-video 作者: appsembler 项目源码 文件源码
def _refresh_access_token(self):
        """
        Request new access token to send with requests to Brightcove. Access Token expires every 5 minutes.
        """
        url = "https://oauth.brightcove.com/v3/access_token"
        params = {"grant_type": "client_credentials"}
        auth_string = base64.encodestring(
            '{}:{}'.format(self.api_key, self.api_secret)
        ).replace('\n', '')
        headers = {
            "Content-Type": "application/x-www-form-urlencoded",
            "Authorization": "Basic " + auth_string
        }
        resp = requests.post(url, headers=headers, data=params)
        if resp.status_code == httplib.OK:
            result = resp.json()
            return result['access_token']
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号