def _connect(self): if self._cvat_cli is not None: return print("Enter credentials for '%s' to read task data:" % \ (self._config.server_url)) username = input('User: ') password = getpass.getpass() session = requests.Session() api = CVAT_API_V1(self._config.server_url) cli = CVAT_CLI(session, api, credentials=(username, password)) self._cvat_cli = cli
def _connect(self): if self._session is not None: return session = None try: print("Enter credentials for '%s' to read task data:" % \ (self._config.server_url)) username = input('User: ') password = getpass.getpass() session = requests.Session() session.auth = (username, password) api = CVAT_API_V1(self._config.server_url) cli = CVAT_CLI(session, api) self._session = session self._cvat_cli = cli except Exception: if session is not None: session.close()