__init__.py 文件源码

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

项目:HOTBot 作者: adammhaile 项目源码 文件源码
def get_credentials(self):
        conf_dir = self.get_conf_dir()
        credential_path = os.path.join(conf_dir, self.event + '_credentials.json')

        store = oauth2client.file.Storage(credential_path)
        credentials = store.get()
        if not credentials or credentials.invalid:
            log.warn("No current valid Google credentials. Starting authentication flow...")
            flow = client.flow_from_clientsecrets(os.path.join(conf_dir, 'client_secret.json'),
                                                  'https://www.googleapis.com/auth/calendar')
            flow.user_agent = "HOTBot"
            if self.flags:
                credentials = tools.run_flow(flow, store, self.flags)
            else:  # Needed only for compatibility with Python 2.6
                credentials = tools.run(flow, store)
            log.info('Storing credentials to ' + credential_path)
        return credentials
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号