Skip to content

Commit

Permalink
network.auth.MultiDomainBasicAuth: Allow disabling keyring
Browse files Browse the repository at this point in the history
Kept it enabled by default, so as not to break tests.
  • Loading branch information
nbraud committed Jan 6, 2021
1 parent c4fa661 commit 672a6a2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pip/_internal/network/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ def get_keyring_auth(cls, url, username):
cls._keyring = None
return None


def __init__(self, prompting=True, index_urls=None):
# type: (bool, Optional[List[str]]) -> None
def __init__(self, enable_keyring=True, prompting=True, index_urls=None):
# type: (bool, bool, Optional[List[str]]) -> None
self.prompting = prompting
self.index_urls = index_urls
self.enable_keyring = enable_keyring
self.passwords = {} # type: Dict[str, AuthInfo]
# When the user is prompted to enter credentials and keyring is
# available, we will offer to save them. If the user accepts,
Expand Down Expand Up @@ -162,7 +162,7 @@ def _get_new_credentials(self, original_url, allow_netrc=True,
return netrc_auth

# If we don't have a password and keyring is available, use it.
if allow_keyring:
if allow_keyring and self.enable_keyring:
# The index url is more specific than the netloc, so try it first
kr_auth = (
self.get_keyring_auth(index_url, username) or
Expand Down

0 comments on commit 672a6a2

Please sign in to comment.