def prompt_for_credentials(self): pypirc_file = os.path.expanduser("~/.pypirc") if not os.path.isfile(pypirc_file): pypirc = None else: pypirc = configparser.Rawconfigparser() pypirc.read([pypirc_file]) missing_errs = ( configparser.NoSectionError, configparser.NoOptionError) # Try to find username in .pypirc if self.username is None: if pypirc is not None: try: self.username = pypirc.get("server-login", "username") except missing_errs: pass # Prompt for username on command-line if self.username is None: print(("Username: "******"server-login", "password") except missing_errs: pass # Prompt for username on command-line if self.password is None: self.password = getpass.getpass("Password: "******"PyPI requires a username") if not self.password: raise ValueError("PyPI requires a password")
def prompt_for_credentials(self): pypirc_file = os.path.expanduser("~/.pypirc") if not os.path.isfile(pypirc_file): pypirc = None else: pypirc = configparser.Rawconfigparser() pypirc.read([pypirc_file]) missing_errs = (configparser.NoSectionError, configparser.NoOptionError) # Try to find username in .pypirc if self.username is None: if pypirc is not None: try: self.username = pypirc.get("server-login", "username") except missing_errs: pass # Prompt for username on command-line if self.username is None: print(("Username: "******"server-login", "password") except missing_errs: pass # Prompt for username on command-line if self.password is None: self.password = getpass.getpass("Password: "******"PyPI requires a username") if not self.password: raise ValueError("PyPI requires a password")
def prompt_for_credentials(self): credentials = {} if "%(username)s" in self.url: print(("Username: "******"username"] = input().strip() if "%(password)s" in self.url: credentials["password"] = getpass.getpass("Password: ") if credentials: self.url = self.url % credentials