-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
I wanted to login in using oras.provider.Registry.login without supplying a username and password and prompt for it. According to the source code this is already implemented but the execution never reaches that step because username and password have not been specified as optional arguments. Instead I get the error TypeError: Registry.login() missing 2 required positional arguments: 'username' and 'password'. I have to explicitly do login(username=None, password=None) for it to work.
oras.provider.Registry.login:
def login(
self,
username: str,
password: str,
password_stdin: bool = False,
tls_verify: bool = True,
hostname: Optional[str] = None,
config_path: Optional[str] = None,
) -> dict:
"""
Login to a registry.
:param username: the user account name
:type username: str
:param password: the user account password
:type password: str
:param password_stdin: get the password from standard input
:type password_stdin: bool
:param insecure: use http instead of https
:type insecure: bool
:param tls_verify: verify tls
:type tls_verify: bool
:param hostname: the hostname to login to
:type hostname: str
:param config_path: custom config path to add credentials to
:type config_path: str
"""
# Read password from stdin
if password_stdin:
password = oras.utils.readline()
# No username, try to get from stdin
if not username:
username = input("Username: ")
# No password provided
if not password:
password = input("Password: ")
if not password:
raise ValueError("password required")
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels