def __init__(self, client: CDPSession, frameManager: FrameManager) -> None:
        """Make new NetworkManager."""
        super().__init__()
        self._client = client
        self._frameManager = frameManager
        self._requestIdToRequest: Dict[Optional[str], Request] = dict()
        self._requestIdToResponseWillBeSent: Dict[Optional[str], Dict] = dict()
        self._extraHTTPHeaders: OrderedDict[str, str] = OrderedDict()
        self._offline: bool = False
        self._credentials: Optional[Dict[str, str]] = None
        self._attemptedAuthentications: Set[Optional[str]] = set()
        self._userRequestInterceptionEnabled = False
        self._protocolRequestInterceptionEnabled = False
        self._requestHashToRequestIds = Multimap()
        self._requestHashToInterceptionIds = Multimap()

        self._client.on(
            'Network.requestWillBeSent',
            lambda event: self._client._loop.create_task(
                self._onRequestWillBeSent(event)),
        )
        self._client.on('Network.requestIntercepted',
                        self._onRequestIntercepted)  # noqa: E501
        self._client.on('Network.requestServedFromCache',
                        self._onRequestServedFromCache)  # noqa: #501
        self._client.on('Network.responseReceived', self._onResponseReceived)
        self._client.on('Network.loadingFinished', self._onLoadingFinished)
        self._client.on('Network.loadingFailed', self._onLoadingFailed)
Ejemplo n.º 2
0
    def __init__(self, client: CDPSession, frameManager,
                 _ignoreHTTPSErrors) -> None:
        """Make new NetworkManager."""
        super().__init__()
        self._client = client
        self._ignoreHTTPSErrors = _ignoreHTTPSErrors
        self._frameManager = frameManager
        self._requestIdToRequest: Dict[Optional[str], Request] = dict()
        self._interceptionIdToRequest: Dict[Optional[str], Request] = dict()
        self._extraHTTPHeaders: OrderedDict[str, str] = OrderedDict()
        self._offline: bool = False
        self._credentials: Optional[Dict[str, str]] = None
        self._attemptedAuthentications: Set[str] = set()
        self._userRequestInterceptionEnabled = False
        self._protocolRequestInterceptionEnabled = False
        self._requestHashToRequestIds = Multimap()
        self._requestIdToInterceptionId = {}
        self._requestHashToInterceptionIds = Multimap()
        self._userCacheDisabled = False
        self._requestIdToRequestWillBeSentEvent = {}
        self._client.on('Fetch.requestPaused', self._onRequestPaused)
        self._client.on('Fetch.authRequired', self._onAuthRequired)

        self._client.on('Network.requestWillBeSent', self._onRequestWillBeSent)
        self._client.on('Network.requestServedFromCache',
                        self._onRequestServedFromCache)  # noqa: #501
        self._client.on('Network.responseReceived', self._onResponseReceived)
        self._client.on('Network.loadingFinished', self._onLoadingFinished)
        self._client.on('Network.loadingFailed', self._onLoadingFailed)
Ejemplo n.º 3
0
    def __init__(self, client: Session) -> None:
        """Make new NetworkManager."""
        super().__init__()
        self._client = client
        self._requestIdToRequest: Dict[str, Request] = dict()
        self._interceptionIdToRequest: Dict[str, Request] = dict()
        self._extraHTTPHeaders: OrderedDict[str, str] = OrderedDict()
        self._requestInterceptionEnabled = False
        self._requestHashToRequestIds = Multimap()
        self._requestHashToInterceptions = Multimap()

        self._client.on('Network.requestWillBeSent', self._onRequestWillBeSent)
        self._client.on('Network.requestIntercepted',
                        self._onRequestIntercepted)  # noqa: E501
        self._client.on('Network.responseReceived', self._onResponseReceived)
        self._client.on('Network.loadingFinished', self._onLoadingFinished)
        self._client.on('Network.loadingFailed', self._onLoadingFailed)
Ejemplo n.º 4
0
    def __init__(self, client):
        super().__init__()
        self._client = client
        self._request_id_to_request = {}
        self._interception_id_to_request = {}
        self._extra_http_headers = {}

        self._request_interception_enabled = False
        self._request_hash_to_request_ids = Multimap()
        self._request_hash_to_interceptions = Multimap()

        self._client.on('Network.requestWillBeSent',
                        self._on_request_will_be_sent)
        self._client.on('Network.requestIntercepted',
                        self._on_request_intercepted)
        self._client.on('Network.responseReceived', self._on_response_received)
        self._client.on('Network.loadingFinished', self._on_loading_finished)
        self._client.on('Network.loadingFailed', self._on_loading_failed)
Ejemplo n.º 5
0
    def __init__(self, client: Session) -> None:
        """Make new NetworkManager."""
        super().__init__()
        self._client = client
        self._requestIdToRequest: Dict[Optional[str], Request] = dict()
        self._interceptionIdToRequest: Dict[Optional[str], Request] = dict()
        self._extraHTTPHeaders: OrderedDict[str, str] = OrderedDict()
        self._offline: bool = False
        self._credentials: Optional[Dict[str, str]] = None
        self._attemptedAuthentications: Set[str] = set()
        self._userRequestInterceptionEnabled = False
        self._protocolRequestInterceptionEnabled = False
        self._requestHashToRequestIds = Multimap()
        self._requestHashToInterceptionIds = Multimap()

        self._client.on('Network.requestWillBeSent', self._onRequestWillBeSent)
        self._client.on('Network.requestIntercepted',
                        self._onRequestIntercepted)  # noqa: E501
        self._client.on('Network.responseReceived', self._onResponseReceived)
        self._client.on('Network.loadingFinished', self._onLoadingFinished)
        self._client.on('Network.loadingFailed', self._onLoadingFailed)
Ejemplo n.º 6
0
 def __init__(self, client: CDPSession, frameManager: FrameManager) -> None:
     'Make new NetworkManager.'
     super().__init__()
     self._client = client
     self._frameManager = frameManager
     self._requestIdToRequest = dict()
     self._interceptionIdToRequest = dict()
     self._extraHTTPHeaders = OrderedDict()
     self._offline = False
     self._credentials = None
     self._attemptedAuthentications = set()
     self._userRequestInterceptionEnabled = False
     self._protocolRequestInterceptionEnabled = False
     self._requestHashToRequestIds = Multimap()
     self._requestHashToInterceptionIds = Multimap()
     self._client.on('Network.requestWillBeSent', self._onRequestWillBeSent)
     self._client.on('Network.requestIntercepted',
                     self._onRequestIntercepted)
     self._client.on('Network.responseReceived', self._onResponseReceived)
     self._client.on('Network.loadingFinished', self._onLoadingFinished)
     self._client.on('Network.loadingFailed', self._onLoadingFailed)