@bugzilla.command()<EOL>@click.argument("<STR_LIT>", default="<STR_LIT>")<EOL>@pass_config<EOL>def login(config, api_key="<STR_LIT>"):
if not api_key:<EOL><INDENT>info_out(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL>api_key = getpass.getpass("<STR_LIT>")<EOL><DEDENT>url = urllib.parse.urljoin(config.bugzilla_url, "<STR_LIT>")<EOL>assert url.startswith("<STR_LIT>"), url<EOL>response = requests.get(url, params={"<STR_LIT>": api_key})<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>if response.json().get("<STR_LIT:error>"):<EOL><INDENT>error_out("<STR_LIT>".format(response.json()))<EOL><DEDENT>else:<EOL><INDENT>update(<EOL>config.configfile,<EOL>{<EOL>"<STR_LIT>": {<EOL>"<STR_LIT>": config.bugzilla_url,<EOL>"<STR_LIT>": api_key,<EOL>}<EOL>},<EOL>)<EOL>success_out("<STR_LIT>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>error_out("<STR_LIT>".format(response.status_code, response.json()))<EOL><DEDENT>
Store your Bugzilla API Key