コード例 #1
0
ファイル: mitmproxy.py プロジェクト: ktanable1/selenium-wire
    def _create_request(self, flow, response=None):
        request = Request(method=flow.request.method,
                          url=flow.request.url,
                          headers=[(k, v)
                                   for k, v in flow.request.headers.items()],
                          body=flow.request.raw_content)
        request.response = response

        return request
コード例 #2
0
ファイル: handler.py プロジェクト: richard-ql/selenium-wire
    def _create_request(self, flow, response=None):
        request = Request(
            method=flow.request.method,
            url=flow.request.url,
            headers=[(k, v) for k, v in flow.request.headers.items()],
            body=flow.request.raw_content
        )

        # For websocket requests, the scheme of the request is overwritten with https
        # in the initial CONNECT request so this hack explicitly sets the scheme back to wss.
        if websockets.check_handshake(request.headers) and websockets.check_client_version(request.headers):
            request.url = request.url.replace('https', 'wss', 1)

        request.response = response

        return request