@@ -166,6 +166,11 @@ class Client(Methods, Scaffold):
166166 request that raises a flood wait will be automatically invoked again after sleeping for the required amount
167167 of time. Flood wait exceptions requiring higher waiting times will be raised.
168168 Defaults to 60 (seconds).
169+
170+ hide_password (``bool``, *optional*):
171+ Pass True to hide the password when typing it during the login.
172+ Defaults to False, because ``getpass`` (the library used) is known to be problematic in some
173+ terminal environments.
169174 """
170175
171176 def __init__ (
@@ -192,7 +197,8 @@ def __init__(
192197 parse_mode : str = Scaffold .PARSE_MODES [0 ],
193198 no_updates : bool = None ,
194199 takeout : bool = None ,
195- sleep_threshold : int = Session .SLEEP_THRESHOLD
200+ sleep_threshold : int = Session .SLEEP_THRESHOLD ,
201+ hide_password : bool = False
196202 ):
197203 super ().__init__ ()
198204
@@ -220,6 +226,7 @@ def __init__(
220226 self .no_updates = no_updates
221227 self .takeout = takeout
222228 self .sleep_threshold = sleep_threshold
229+ self .hide_password = hide_password
223230
224231 self .executor = ThreadPoolExecutor (self .workers , thread_name_prefix = "Handler" )
225232
@@ -328,7 +335,7 @@ async def authorize(self) -> User:
328335 print ("Password hint: {}" .format (await self .get_password_hint ()))
329336
330337 if not self .password :
331- self .password = await ainput ("Enter password (empty to recover): " , hide = True )
338+ self .password = await ainput ("Enter password (empty to recover): " , hide = self . hide_password )
332339
333340 try :
334341 if not self .password :
0 commit comments