Skip to content

Commit

Permalink
Switch to defining get_password
Browse files Browse the repository at this point in the history
  • Loading branch information
judahrand committed Nov 9, 2022
1 parent 6ec0af5 commit d57e834
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/pip/_internal/network/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,16 @@ class KeyRingCli:
"""

@classmethod
def get_credential(
cls, service_name: str, username: Optional[str]
def get_password(
cls, service_name: str, username: str
) -> Optional[KeyRingCredential]:
cmd = ["keyring", "get", service_name, str(username)]
cmd = ["keyring", "get", service_name, username]
res = subprocess.run(
cmd, capture_output=True, env=dict(PYTHONIOENCODING="utf-8")
)
if res.returncode:
return None
password = res.stdout.decode("utf-8").strip("\n")
return KeyRingCredential(username=username, password=password)
return res.stdout.decode("utf-8").strip("\n")

@classmethod
def set_password(cls, service_name: str, username: str, password: str) -> None:
Expand Down

0 comments on commit d57e834

Please sign in to comment.