Ejemplo n.º 1
0
    def execute(self):
        # TODO Blindly assume that we don't mind nuking config
        gh = Github("https://api.github.com")
        oauth = OauthWrapper()
        with github_cli.config.Config().new() as conf:
            webbrowser.open(gh.oauth.auth_url(id=oauth.get_id()))

            code = oauth.get_code()
            req_data = {
                "client_id": github_cli.config.CLIENT_KEY,
                "client_secret": github_cli.config.CLIENT_SECRET,
                "code": code
                }

            conf["access_token"] = gh.oauth("access_token", req_data)["access_token"]
            conf["username"] = self.args.username