Beispiel #1
0
 def _prompt_for_password(self, netloc):
     username = ask_input("User for %s: " % netloc)
     if not username:
         return None, None
     auth = _get_keyring_auth(netloc, username)
     if auth:
         return auth[0], auth[1], False
     password = ask_password("Password: ")
     return username, password, True
Beispiel #2
0
 def _prompt_for_password(self, netloc):
     username = ask_input("User for {}: ".format(netloc))
     if not username:
         return None, None
     auth = get_keyring_auth(netloc, username)
     if auth and auth[0] is not None and auth[1] is not None:
         return auth[0], auth[1], False
     password = ask_password("Password: ")
     return username, password, True
Beispiel #3
0
 def _prompt_for_password(self, netloc):
     # type: (str) -> Tuple[Optional[str], Optional[str], bool]
     username = ask_input(f"User for {netloc}: ")
     if not username:
         return None, None, False
     auth = get_keyring_auth(netloc, username)
     if auth and auth[0] is not None and auth[1] is not None:
         return auth[0], auth[1], False
     password = ask_password("Password: ")
     return username, password, True
Beispiel #4
0
        req.url = url

        if username is not None and password is not None:
            # Send the basic auth with this request
            req = HTTPBasicAuth(username, password)(req)

        # Attach a hook to handle 401 responses
        req.register_hook("response", self.handle_401)

        return req

    # Factored out to allow for easy patching in tests
    def _prompt_for_password(self, netloc):
<<<<<<< HEAD
        # type: (str) -> Tuple[Optional[str], Optional[str], bool]
        username = ask_input("User for {}: ".format(netloc))
        if not username:
            return None, None, False
        auth = get_keyring_auth(netloc, username)
        if auth and auth[0] is not None and auth[1] is not None:
=======
        username = ask_input("User for {}: ".format(netloc))
        if not username:
            return None, None
        auth = get_keyring_auth(netloc, username)
        if auth:
>>>>>>> b66a76afa15ab74019740676a52a071b85ed8f71
            return auth[0], auth[1], False
        password = ask_password("Password: ")
        return username, password, True