#!/usr/bin/env python3 # -*- encoding: utf-8 -*- if __name__ == "__main__": from clients.StandaloneClient import StandaloneClient from clients.WebClient.WebClient import WebClient # start client client = StandaloneClient(client_class=WebClient) client.run()
self._connection.load_system_host_keys() self._connection.set_missing_host_key_policy( paramiko.WarningPolicy()) self._connection.connect(**args) self._connected = True self._logger.debug("Connected") break except paramiko.ssh_exception.AuthenticationException: self._logger.error("Auth error") except Exception as e: self._logger.error("Error: %s, %s" % (e.errno, e.strerror)) self._connection = None self._connected = False def _disconnect(self): self._logger.debug("SSHClient._disconnect()") self._connected = False if self._connection: self._connection.close() self._connection = None # use StandaloneClient to keep argparsing stuff central for every client if __name__ == '__main__': from clients.StandaloneClient import StandaloneClient # start client client = StandaloneClient.StandaloneClient(client_class=SSHClient) client.run()
content_length = int(response.headers.get("Content-length", -1)) timing = stop - start else: content_length = -1 timing = -1 metric = {"timing": timing, "url": url, "content_length" : content_length} self._create_metric(metric=metric) except Exception as e: content_length = -1 timing = -1 metric = {"timing": timing, "url": url, "content_length" : content_length} self._create_metric(metric=metric) self._logger.error(e) # if server refuses connection wait a bit and don't spam with requests if type(e) is requests.exceptions.ConnectionError: self._logger.debug("Connection refused - sleeping") time.sleep(0.5) if __name__ == '__main__': from clients.StandaloneClient import StandaloneClient # start client client = StandaloneClient.StandaloneClient(client_class=WebDLClient) client.run()
self._browser.quit() def _apply_config(self): self._logger.debug("WebRTCClient._apply_config()") if not self._browser: firefox_options = webdriver.firefox.options.Options() firefox_options.add_argument("--private-window") firefox_options.add_argument("--headless") firefox_profile = webdriver.FirefoxProfile() firefox_profile.set_preference( "media.navigator.permission.disabled", True) firefox_profile.set_preference("media.navigator.streams.fake", True) log_path = os.path.join(self._log_dir, "geckodriver.log") self._browser = webdriver.Firefox(firefox_profile=firefox_profile, firefox_options=firefox_options, log_path=log_path) if __name__ == '__main__': from clients.StandaloneClient import StandaloneClient # start client client = StandaloneClient.StandaloneClient(client_class=WebRTCClient) client.run()
cmd = "lsof -t %s" % logf #self._logger.debug("CMD: %s" % cmd) try: out = subprocess.check_output(cmd, shell=True) except subprocess.CalledProcessError: # Exception means no process has the file open right now return True return False def clean_up(self): self._logger.debug("VoIPClient.clean_up()") self._itgrecv.stop() self.unregister_application() def _apply_config(self): self._logger.debug("VoIPClient._apply_config()") if __name__ == '__main__': from clients.StandaloneClient import StandaloneClient # start client client = StandaloneClient.StandaloneClient(client_class=VoIPClient) client.run()
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- if __name__ == "__main__": from clients.StandaloneClient import StandaloneClient from clients.DASHClient.DASHClient import DASHClient # start client client = StandaloneClient(client_class=DASHClient) client.run()
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- if __name__ == "__main__": from clients.StandaloneClient import StandaloneClient from clients.VoIPClient.VoIPClient import VoIPClient # start client client = StandaloneClient(client_class=VoIPClient) client.run()