mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 04:02:32 +01:00
interactively prompt for passwords on login when none is provided
This commit is contained in:
parent
db978b34f1
commit
9dd5cb8c8a
@ -379,7 +379,7 @@ Description
|
||||
The username and password to use when attempting to log in to
|
||||
another site.
|
||||
|
||||
Specifying a username and password is required for
|
||||
Specifying username and password is required for
|
||||
|
||||
* ``nijie``
|
||||
|
||||
@ -415,6 +415,10 @@ Description
|
||||
(*) The password value for these sites should be
|
||||
the API key found in your user profile, not the actual account password.
|
||||
|
||||
Note: Leave the ``password`` value empty or undefined
|
||||
to get prompted for a passeword when performing a login
|
||||
(see `getpass() <https://docs.python.org/3/library/getpass.html#getpass.getpass>`__).
|
||||
|
||||
|
||||
extractor.*.netrc
|
||||
-----------------
|
||||
|
@ -233,7 +233,7 @@ class Extractor():
|
||||
password = None
|
||||
|
||||
if username:
|
||||
password = self.config("password")
|
||||
password = self.config("password") or util.LazyPrompt()
|
||||
elif self.config("netrc", False):
|
||||
try:
|
||||
info = netrc.netrc().authenticators(self.category)
|
||||
|
@ -14,6 +14,7 @@ import sys
|
||||
import json
|
||||
import time
|
||||
import random
|
||||
import getpass
|
||||
import hashlib
|
||||
import sqlite3
|
||||
import binascii
|
||||
@ -487,6 +488,13 @@ CODES = {
|
||||
}
|
||||
|
||||
|
||||
class LazyPrompt():
|
||||
__slots__ = ()
|
||||
|
||||
def __str__(self):
|
||||
return getpass.getpass()
|
||||
|
||||
|
||||
class CustomNone():
|
||||
"""None-style type that supports more operations than regular None"""
|
||||
__slots__ = ()
|
||||
|
Loading…
Reference in New Issue
Block a user