Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
resp.raise_for_status()
jsondata = resp.json()
if not jsondata["success"]:
raise SessionBrokenError("app launch failed",
jsondata["error"], jsondata["output"])
time.sleep(2.5) # wait launch finished, maybe no need
pid = self._pidof_app(pkg_name)
if not pid:
if strict:
raise SessionBrokenError(pkg_name)
return self.session(pkg_name,
attach=False,
launch_timeout=launch_timeout)
return Session(self, pkg_name, pid)
def __repr__(self):
if self._pid and self._pkg_name:
return "" % (
self._pid, self._pkg_name)
return super(Session, self).__repr__()
Args:
host (str): host address
port (int): port number
Raises:
EnvironmentError
"""
self._host = host
self._port = port
self._adb_device = None # adbutils.Device
self._serial = None
self._reqsess = TimeoutRequestsSession(
) # use requests.Session to enable HTTP Keep-Alive
self._server_url = 'http://{}:{}'.format(host, port)
self._server_jsonrpc_url = self._server_url + "/jsonrpc/0"
self._default_session = Session(self, None)
self._cached_plugins = {}
self._hooks = {}
self.__devinfo = None
self.__uiautomator_failed = False
self.__uiautomator_lock = threading.Lock()
self.platform = None # hot fix for weditor
self.ash = AdbShell(self.shell) # the powerful adb shell
self._freeze() # prevent creating new attrs
# self._atx_agent_check()