'Check that ``username`` and ``password`` have been set, and raise an
exception if not.'

def check_credentials(self):

    if ((self.username is None) or (self.password is None)):
        raise DistlibException('username    and    password    must    be    set')
    pm = HTTPPasswordMgr()
    (_, netloc, _, _, _, _) = urlparse(self.url)
    pm.add_password(self.realm, netloc, self.username, self.password)
    self.password_handler = HTTPBasicAuthHandler(pm)
