pivotalcli/commands/login.py

17 lines
349 B
Python
Raw Normal View History

2018-04-03 10:56:07 +00:00
import argparse
import getpass
import api.me
from config import Config
def login(arguments: argparse.Namespace) -> None:
username = input('E-mail: ')
password = getpass.getpass()
me = api.me.get(username, password)
Config['user']['api_token'] = me['api_token']
Config['user']['initials'] = me['initials']
Config.write()