1
0
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:
Mike Fährmann 2023-12-06 21:31:31 +01:00
parent db978b34f1
commit 9dd5cb8c8a
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 14 additions and 2 deletions

View File

@ -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
-----------------

View File

@ -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)

View File

@ -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__ = ()