@github.command()<EOL>@click.argument("<STR_LIT>", default="<STR_LIT>")<EOL>@pass_config<EOL>def token(config, token):
if not token:<EOL><INDENT>info_out(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>'<STR_LIT>'<EOL>)<EOL>token = getpass.getpass("<STR_LIT>").strip()<EOL><DEDENT>url = urllib.parse.urljoin(config.github_url, "<STR_LIT>")<EOL>assert url.startswith("<STR_LIT>"), url<EOL>response = requests.get(url, headers={"<STR_LIT>": "<STR_LIT>".format(token)})<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>update(<EOL>config.configfile,<EOL>{<EOL>"<STR_LIT>": {<EOL>"<STR_LIT>": config.github_url,<EOL>"<STR_LIT>": token,<EOL>"<STR_LIT>": response.json()["<STR_LIT>"],<EOL>}<EOL>},<EOL>)<EOL>name = response.json()["<STR_LIT:name>"] or response.json()["<STR_LIT>"]<EOL>success_out("<STR_LIT>".format(name))<EOL><DEDENT>else:<EOL><INDENT>error_out("<STR_LIT>".format(response.status_code, response.content))<EOL><DEDENT>
Store and fetch a GitHub access token