Fix password input with win_unicode_console
This commit is contained in:
parent
4e4820a85e
commit
4cac3fbcc9
|
@ -9,10 +9,12 @@ import textwrap
|
|||
import threading
|
||||
import queue
|
||||
import platform
|
||||
wuc_enabled=False
|
||||
if platform.system().startswith("Windows"):
|
||||
try:
|
||||
import win_unicode_console
|
||||
win_unicode_console.enable()
|
||||
wuc_enabled=True
|
||||
except Exception as e:
|
||||
print("Warning: Enabling win_unicode_console failed (" +str(e)+ "), using native encoding.")
|
||||
from collections import OrderedDict
|
||||
|
@ -278,7 +280,9 @@ def authenticate(context: contentapi.ApiContext,message):
|
|||
while True:
|
||||
print(message)
|
||||
username = input("Username: ")
|
||||
if wuc_enabled: win_unicode_console.disable()
|
||||
password = getpass.getpass("Password: ")
|
||||
if wuc_enabled: win_unicode_console.enable(); colorama_init()
|
||||
try:
|
||||
token = context.login(username, password, config["expire_seconds"])
|
||||
with open(config["tokenfile"], 'w') as f:
|
||||
|
|
Loading…
Reference in New Issue