Guest User

Untitled

a guest
Oct 26th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. try:
  2. config = yaml.load(open(CONFIGFILE).read())
  3. except:
  4. config = None
  5.  
  6. if not config: config = {}
  7.  
  8. username = config.get('username', None)
  9. password = keyring.get_password(PROGRAM, username) if username else None
  10.  
  11. @click.command()
  12. @click.option('--username', '-u', type=str, default=username, required=not username)
  13. @click.option('--password', '-p', type=str, hide_input=True, confirmation_prompt=True, default=password, prompt=not password)
  14. def main(username, password):
  15. session = tidalapi.Session()
  16. session.login(username, password)
  17.  
  18. if not session.check_login():
  19. click.echo("Invalid credentials.")
  20. raise SystemError
Add Comment
Please, Sign In to add comment