mirror of
https://github.com/ihabunek/toot.git
synced 2024-09-29 04:35:54 -04: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 `--scheduled-at` option to `toot post`, allows scheduling toots"
|
||||||
- "Add `--description` option to `toot post`, for adding descriptions to media attachments (thanks @ansuz)"
|
- "Add `--description` option to `toot post`, for adding descriptions to media attachments (thanks @ansuz)"
|
||||||
- "Disable paging timeline when output is piped (thanks @stacyharper)"
|
- "Disable paging timeline when output is piped (thanks @stacyharper)"
|
||||||
|
- "Allow piping the password to login_cli for testing purposes (thanks @NinjaTrappeur)"
|
||||||
|
|
||||||
0.27.0:
|
0.27.0:
|
||||||
date: 2020-06-15
|
date: 2020-06-15
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
from builtins import input
|
from builtins import input
|
||||||
@ -66,7 +67,13 @@ def login_interactive(app, email=None):
|
|||||||
while not email:
|
while not email:
|
||||||
email = input('Email: ')
|
email = input('Email: ')
|
||||||
|
|
||||||
|
# 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: ')
|
password = getpass('Password: ')
|
||||||
|
else:
|
||||||
|
password = sys.stdin.read().strip()
|
||||||
|
print_out("Password: <green>read from stdin</green>")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print_out("Authenticating...")
|
print_out("Authenticating...")
|
||||||
|
Loading…
Reference in New Issue
Block a user