Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add-cli-setup-command #191

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions evalai/login.py → evalaiconfigure.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
from evalai.utils.auth import get_user_auth_token_by_login
from evalai.utils.config import AUTH_TOKEN_PATH, AUTH_TOKEN_DIR


@click.group(invoke_without_command=True)
@click.pass_context
def login(ctx):
"""
Login to EvalAI and save token.
Add Authorisation Key and Host ID.
"""
username = click.prompt("username", type=str, hide_input=False)
password = click.prompt("Enter password", type=str, hide_input=True)
token = get_user_auth_token_by_login(username, password)
authkey = click.prompt("AUTHORISATION KEY", type=str, hide_input=False)
host = click.prompt("HOST ID", type=str, hide_input=False)
token = get_user_auth_token_by_login(authkey, host)

if os.path.exists(AUTH_TOKEN_PATH):
with open(str(AUTH_TOKEN_PATH), "w") as TokenFile:
Expand All @@ -32,4 +31,4 @@ def login(ctx):
except (OSError, IOError) as e:
echo(e)

echo(style("\nLogged in successfully!", bold=True))
echo(style("\nEvalAI is Configured Successfully!", bold=True))