Skip to content

Instantly share code, notes, and snippets.

@jamesstidard
Last active June 2, 2018 11:36
Show Gist options
  • Save jamesstidard/6c5118f3b09a551f6212f08d7e466bab to your computer and use it in GitHub Desktop.
Save jamesstidard/6c5118f3b09a551f6212f08d7e466bab to your computer and use it in GitHub Desktop.
import click
@click.command()
def login():
password = click.prompt('Password: ', hide_input=True)
session_token = ''.join(reversed(password)) # exchange password for session token in some way
click.echo('export MY_SESSION_TOKEN="{}"'.format(session_token))
if __name__ == '__main__':
login()
# Called from bash with: eval $(python click-login.py)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment