コード例 #1
0
ファイル: network_manager.py プロジェクト: stav/splash
    def _initialHarData(self, start_time, operation, request, outgoingData):
        """ Return initial values for HAR entry """
        return {
            '_tmp': {
                'start_time': start_time,
                'request_start_sending_time': start_time,
                'request_sent_time': start_time,
                'response_start_time': start_time,

                # 'outgoingData': outgoingData,
                'state': self.REQUEST_CREATED,
            },
            "startedDateTime": har.format_datetime(start_time),
            "request": har_qt.request2har(request, operation, outgoingData),
            "response": {
                "bodySize": -1,
            },
            "cache": {},
            "timings": {
                "blocked": -1,
                "dns": -1,
                "connect": -1,
                "ssl": -1,

                "send": 0,
                "wait": 0,
                "receive": 0,
            },
            "time": 0,
        }
コード例 #2
0
ファイル: network_manager.py プロジェクト: yzou/splash
    def _initialHarData(self, start_time, operation, request, outgoingData):
        """ Return initial values for HAR entry """
        return {
            '_tmp': {
                'start_time': start_time,
                'request_start_sending_time': start_time,
                'request_sent_time': start_time,
                'response_start_time': start_time,

                # 'outgoingData': outgoingData,
                'state': self.REQUEST_CREATED,
            },
            "startedDateTime": har.format_datetime(start_time),
            "request": har_qt.request2har(request, operation, outgoingData),
            "response": {
                "bodySize": -1,
            },
            "cache": {},
            "timings": {
                "blocked": -1,
                "dns": -1,
                "connect": -1,
                "ssl": -1,
                "send": 0,
                "wait": 0,
                "receive": 0,
            },
            "time": 0,
        }
コード例 #3
0
    def _initial_entry_data(self, start_time, operation, request,
                            outgoingData):
        """
        Return initial values for a new HAR entry.
        """
        return {
            # custom fields
            '_tmp': {
                'start_time': start_time,
                'request_start_sending_time': start_time,
                'request_sent_time': start_time,
                'response_start_time': start_time,
                # 'outgoingData': outgoingData,
            },
            '_splash_processing_state': self.REQUEST_CREATED,

            # standard fields
            "startedDateTime": format_datetime(start_time),
            "request": request2har(request, operation, outgoingData),
            "response": {
                "bodySize": -1,
            },
            "cache": {},
            "timings": {
                "blocked": -1,
                "dns": -1,
                "connect": -1,
                "ssl": -1,
                "send": 0,
                "wait": 0,
                "receive": 0,
            },
            "time": 0,
        }
コード例 #4
0
ファイル: har_builder.py プロジェクト: scrapinghub/splash
    def _initial_entry_data(self, start_time, operation, request, content):
        """
        Return initial values for a new HAR entry.
        """
        return {
            # custom fields
            '_tmp': {
                'start_time': start_time,
                'request_start_sending_time': start_time,
                'request_sent_time': start_time,
                'response_start_time': start_time
            },
            '_splash_processing_state': self.REQUEST_CREATED,

            # standard fields
            "startedDateTime": format_datetime(start_time),
            "request": request2har(request, operation, content),
            "response": {
                "bodySize": -1,
            },
            "cache": {},
            "timings": {
                "blocked": -1,
                "dns": -1,
                "connect": -1,
                "ssl": -1,

                "send": 0,
                "wait": 0,
                "receive": 0,
            },
            "time": 0,
        }
コード例 #5
0
ファイル: qtrender_lua.py プロジェクト: oogee78/splash
 def __init__(self, lua, request, operation, outgoing_data):
     self.request = request
     self.lua = lua
     self.info = self.lua.python2lua(request2har(request, operation, outgoing_data))
     commands = get_commands(self)
     self.commands = self.lua.python2lua(commands)
     self.attr_whitelist = list(commands.keys()) + self._attribute_whitelist
     self._exceptions = []
コード例 #6
0
 def __init__(self, lua, request, operation, outgoing_data):
     self.request = request
     self.lua = lua
     self.info = self.lua.python2lua(
         request2har(request, operation, outgoing_data))
     commands = get_commands(self)
     self.commands = self.lua.python2lua(commands)
     self.attr_whitelist = list(commands.keys()) + self._attribute_whitelist
     self._exceptions = []
コード例 #7
0
ファイル: qtrender_lua.py プロジェクト: Cloverseer/splash
    def __init__(self, lua, exceptions, request, operation, outgoing_data):
        super(_ExposedBoundRequest, self).__init__(lua, exceptions)
        self.request = request

        har_request = request2har(request, operation, outgoing_data)
        self.url = self.lua.python2lua(har_request['url'])
        self.method = self.lua.python2lua(har_request['method'])
        # TODO: make info and headers attributes lazy
        self.info = self.lua.python2lua(har_request)
        self.headers = self.lua.python2lua(get_headers_dict(request))
コード例 #8
0
ファイル: qtrender_lua.py プロジェクト: oogee78/splash
 def __init__(self, lua, reply):
     self.lua = lua
     self.response = reply
     # according to specs HTTP response headers should not contain unicode
     # https://github.com/kennethreitz/requests/issues/1926#issuecomment-35524028
     _headers = {str(k): str(v) for k, v in reply.rawHeaderPairs()}
     self.headers = self.lua.python2lua(_headers)
     self.info = self.lua.python2lua(reply2har(reply))
     commands = get_commands(self)
     self.commands = self.lua.python2lua(commands)
     self.attr_whitelist = list(commands.keys()) + self._attribute_whitelist
     self._exceptions = []
     self.request = self.lua.python2lua(request2har(reply.request(), reply.operation()))
コード例 #9
0
 def __init__(self, lua, reply):
     self.lua = lua
     self.response = reply
     # according to specs HTTP response headers should not contain unicode
     # https://github.com/kennethreitz/requests/issues/1926#issuecomment-35524028
     _headers = {str(k): str(v) for k, v in reply.rawHeaderPairs()}
     self.headers = self.lua.python2lua(_headers)
     self.info = self.lua.python2lua(reply2har(reply))
     commands = get_commands(self)
     self.commands = self.lua.python2lua(commands)
     self.attr_whitelist = list(commands.keys()) + self._attribute_whitelist
     self._exceptions = []
     self.request = self.lua.python2lua(
         request2har(reply.request(), reply.operation()))
コード例 #10
0
ファイル: qtrender_lua.py プロジェクト: dwdm/splash
 def __init__(self, lua, reply, har_entry=None):
     super(_ExposedResponse, self).__init__(lua)
     # according to specs HTTP response headers should not contain unicode
     # https://github.com/kennethreitz/requests/issues/1926#issuecomment-35524028
     _headers = {str(k): str(v) for k, v in reply.rawHeaderPairs()}
     self.headers = self.lua.python2lua(_headers)
     if har_entry is None:
         resp_info = reply2har(reply)
     else:
         resp_info = har_entry['response']
     self.info = self.lua.python2lua(resp_info)
     self.request = self.lua.python2lua(
         request2har(reply.request(), reply.operation())
     )
コード例 #11
0
ファイル: qtrender_lua.py プロジェクト: dwdm/splash
 def __init__(self, lua, request, operation, outgoing_data):
     super(_ExposedRequest, self).__init__(lua)
     self.request = request
     self.info = self.lua.python2lua(
         request2har(request, operation, outgoing_data)
     )
コード例 #12
0
ファイル: qtrender_lua.py プロジェクト: Cloverseer/splash
 def from_reply(cls, lua, exceptions, reply):
     har_request = request2har(reply.request(), reply.operation())
     return cls.from_har(lua, exceptions, har_request)