api.py 文件源码

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

项目:weibo 作者: windskyer 项目源码 文件源码
def token(self, CODE=''):
        client, url = self.getCODE()
        if not self.checked:
            if CODE == '':
                is_open = webbrowser.open_new(url)
                if not is_open:
                    LOG.info(_("Please use the browser to open %(url)s"),
                             {'url': url})
                try:
                    # for python2.x
                    CODE = raw_input(_("Please Input the Code: ")).strip()
                except:
                    # for python3.x
                    CODE = input(_("Please Input the Code: ")).strip()
            try:
                client.set_code(CODE)
            except:
                LOG.error(_("Maybe wrong CODE"))
                return
        token = client.token
        pkl.dump(token, open(str(self.token_file), 'wb'))
        self.api = Client(self.app_key,
                          self.app_secret,
                          self.callback_url, token)
        self.checked = True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号