def get_last_reports(instance, processed_reports): with Client( instance['host'], username=instance['username'], password=instance['password'], port=instance['port'] ) as cli: return get_report_from_task(cli.list_tasks().data, processed_reports)
def download_report_as_csv(report_id, instance): with Client( instance['host'], username=instance['username'], password=instance['password'], port=instance['port'] ) as cli: return cli.download_report( report_id, format_uuid=instance['format_uuid'] )
def test_client_authenticate(): client = Client(HOST) client.socket = None response = client.authenticate(username=USERNAME, password=PASSWORD) assert response.ok client.username = USERNAME client.password = PASSWORD response = client.authenticate() assert response.ok with pytest.raises(exceptions.AuthenticationError): client.authenticate(username=USERNAME, password="******")
def client(request): with Client(HOST, username=USERNAME, password=PASSWORD) as cli: yield cli
def open_connection(self, *args, **kwargs): if not self.openvasClient: self.openvasClient = Client(self.host, self.username, self.password) with self.openvasClient: result = command(self, *args, **kwargs) return result