mirror of
https://github.com/ihabunek/toot
synced 2024-12-25 00:20:55 +01:00
Allow piping the password to login_cli
This is useful for testing where entering a password manually is not possible.
This commit is contained in:
parent
6115cea43e
commit
a3eb5dca24
@ -4,6 +4,7 @@
|
||||
- "Add `--scheduled-at` option to `toot post`, allows scheduling toots"
|
||||
- "Add `--description` option to `toot post`, for adding descriptions to media attachments (thanks @ansuz)"
|
||||
- "Disable paging timeline when output is piped (thanks @stacyharper)"
|
||||
- "Allow piping the password to login_cli for testing purposes (thanks @NinjaTrappeur)"
|
||||
|
||||
0.27.0:
|
||||
date: 2020-06-15
|
||||
|
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import webbrowser
|
||||
|
||||
from builtins import input
|
||||
@ -66,7 +67,13 @@ def login_interactive(app, email=None):
|
||||
while not email:
|
||||
email = input('Email: ')
|
||||
|
||||
password = getpass('Password: ')
|
||||
# Accept password piped from stdin, useful for testing purposes but not
|
||||
# documented so people won't get ideas. Otherwise prompt for password.
|
||||
if sys.stdin.isatty():
|
||||
password = getpass('Password: ')
|
||||
else:
|
||||
password = sys.stdin.read().strip()
|
||||
print_out("Password: <green>read from stdin</green>")
|
||||
|
||||
try:
|
||||
print_out("Authenticating...")
|
||||
|
Loading…
Reference in New Issue
Block a user