Python: module telemetry.internal.backends.chrome_inspector.inspector_websocket

telemetry.internal.backends.chrome_inspector.inspector_websocket | index telemetry/internal/backends/chrome_inspector/inspector_websocket.py

`# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.`

Modules
`` |  |
errno telemetry.core.exceptions | json logging | socket time | telemetry.internal.backends.chrome_inspector.websocket

Classes
`` |  | __builtin__.object InspectorWebsocket telemetry.core.exceptions.Error(exceptions.Exception) WebSocketDisconnected
class InspectorWebsocket(__builtin__.object)
`` |  | Methods defined here: AsyncRequest(self, req, callback) `Sends an async request and returns immediately. Response will be handled in the |callback| later when DispatchNotifications is invoked. Args: callback: a function that takes inspector's response as the argument.` Connect(self, url, timeout=10) `Connects the websocket. Raises: websocket.WebSocketException socket.error` Disconnect(self) `Disconnects the inspector websocket. Raises: websocket.WebSocketException socket.error` DispatchNotifications(self, timeout=10) `Waits for responses from the websocket, dispatching them as necessary. Raises: websocket.WebSocketException: Error from websocket library. socket.error: Error from websocket library. exceptions.WebSocketDisconnected: The socket was disconnected.` RegisterDomain(self, domain_name, notification_handler) `Registers a given domain for handling notification methods. For example, given inspector_backend: def OnConsoleNotification(msg): if msg['method'] == 'Console.messageAdded': print msg['params']['message'] inspector_backend.RegisterDomain('Console', OnConsoleNotification) Args: domain_name: The devtools domain name. E.g., 'Tracing', 'Memory', 'Page'. notification_handler: Handler for devtools notification. Will be called if a devtools notification with matching domain is received via DispatchNotifications. The handler accepts a single paramater: the JSON object representing the notification.` SendAndIgnoreResponse(self, req) `Sends a request without waiting for a response. Raises: websocket.WebSocketException: Error from websocket library. socket.error: Error from websocket library. exceptions.WebSocketDisconnected: The socket was disconnected.` SyncRequest(self, req, timeout=10) `Sends a request and waits for a response. Raises: websocket.WebSocketException: Error from websocket library. socket.error: Error from websocket library. exceptions.WebSocketDisconnected: The socket was disconnected.` UnregisterDomain(self, domain_name) `Unregisters a previously registered domain.` __init__(self) `Create a websocket handler for communicating with Inspectors.` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes defined here: METHOD_NOT_FOUND_CODE = -32601
class WebSocketDisconnected(telemetry.core.exceptions.Error)
`` | `An attempt was made to use a web socket after it had been disconnected.`
| Method resolution order: WebSocketDisconnected telemetry.core.exceptions.Error exceptions.Exception exceptions.BaseException __builtin__.object Methods inherited from telemetry.core.exceptions.Error: AddDebuggingMessage(self, msg) `Adds a message to the description of the exception. Many Telemetry exceptions arise from failures in another application. These failures are difficult to pinpoint. This method allows Telemetry classes to append useful debugging information to the exception. This method also logs information about the location from where it was called.` __init__(self, msg='') __str__(self) Data descriptors inherited from telemetry.core.exceptions.Error: __weakref__ `list of weak references to the object (if defined)` Data and other attributes inherited from exceptions.Exception: __new__ = <built-in method __new__ of type object> `T.__new__(S, ...) -> a new object with type S, a subtype of T` Methods inherited from exceptions.BaseException: __delattr__(...) `x.__delattr__('name') <==> del x.name` __getattribute__(...) `x.__getattribute__('name') <==> x.name` __getitem__(...) `x.__getitem__(y) <==> x[y]` __getslice__(...) `x.__getslice__(i, j) <==> x[i:j] Use of negative indices is not supported.` __reduce__(...) __repr__(...) `x.__repr__() <==> repr(x)` __setattr__(...) `x.__setattr__('name', value) <==> x.name = value` __setstate__(...) __unicode__(...) Data descriptors inherited from exceptions.BaseException: __dict__ args message