当前位置: 首页>>代码示例>>Python>>正文


Python reqser.request_from_dict方法代码示例

本文整理汇总了Python中scrapy.utils.reqser.request_from_dict方法的典型用法代码示例。如果您正苦于以下问题:Python reqser.request_from_dict方法的具体用法?Python reqser.request_from_dict怎么用?Python reqser.request_from_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scrapy.utils.reqser的用法示例。


在下文中一共展示了reqser.request_from_dict方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: response_from_dict

# 需要导入模块: from scrapy.utils import reqser [as 别名]
# 或者: from scrapy.utils.reqser import request_from_dict [as 别名]
def response_from_dict(responsed):
    respcls = load_object(responsed['cls'])

    request = request_from_dict(responsed['request'])

    response = respcls(
        encoding=responsed['encoding'],
        request=request,
        url=responsed['url'],
        status=responsed['status'],
        headers=responsed['headers'],
        body=responsed['body'],
    )

    response.meta.update(responsed['meta'])

    return response 
开发者ID:fabienvauchelles,项目名称:frontoxy,代码行数:19,代码来源:utils.py

示例2: _decode_request

# 需要导入模块: from scrapy.utils import reqser [as 别名]
# 或者: from scrapy.utils.reqser import request_from_dict [as 别名]
def _decode_request(self, encoded_request):
        """Decode an request previously encoded"""
        return request_from_dict(pickle.loads(encoded_request), self.spider) 
开发者ID:onecer,项目名称:sbdspider,代码行数:5,代码来源:queue.py

示例3: _decode_request

# 需要导入模块: from scrapy.utils import reqser [as 别名]
# 或者: from scrapy.utils.reqser import request_from_dict [as 别名]
def _decode_request(self, encoded_request):
        """Decode a request previously encoded"""
        return request_from_dict(pickle.loads(encoded_request), self.spider) 
开发者ID:rdcprojects,项目名称:scrapy-mq-redis,代码行数:5,代码来源:queue.py

示例4: process_response

# 需要导入模块: from scrapy.utils import reqser [as 别名]
# 或者: from scrapy.utils.reqser import request_from_dict [as 别名]
def process_response(self, request, response, spider):
        """ If we were logged out, login again and retry request.
        """
        if request.meta.get('_autologin') and self.is_logout(response):
            autologin_meta = request.meta['_autologin']
            if isinstance(autologin_meta['request'], dict):
                retryreq = request_from_dict(autologin_meta['request'], spider)
            else:
                retryreq = autologin_meta['request'].copy()
            retryreq.dont_filter = True
            logger.debug(
                'Logout at %s: %s', retryreq.url, _response_cookies(response))
            if self.logged_in:
                # We could have already done relogin after initial logout
                if any(autologin_meta['cookie_dict'].get(c['name']) !=
                        c['value'] for c in self.auth_cookies):
                    logger.debug('Request was stale, will retry %s', retryreq)
                else:
                    self.logged_in = False
                    # It's better to re-login straight away
                    yield self._ensure_login(retryreq, spider)
                    logout_count = retryreq.meta['autologin_logout_count'] = (
                        retryreq.meta.get('autologin_logout_count', 0) + 1)
                    if logout_count >= self.max_logout_count:
                        logger.debug('Max logouts exceeded, will not retry %s',
                                     retryreq)
                        raise IgnoreRequest
                    else:
                        logger.debug(
                            'Request caused log out (%d), still retrying %s',
                            logout_count, retryreq)
            returnValue(retryreq)
        returnValue(response) 
开发者ID:TeamHG-Memex,项目名称:autologin-middleware,代码行数:35,代码来源:middleware.py

示例5: get_next_request

# 需要导入模块: from scrapy.utils import reqser [as 别名]
# 或者: from scrapy.utils.reqser import request_from_dict [as 别名]
def get_next_request(self):
        reqd = self._queue_requests.get()
        if not reqd:
            return

        return request_from_dict(reqd, self._spider) 
开发者ID:fabienvauchelles,项目名称:frontoxy,代码行数:8,代码来源:queue.py

示例6: _decode_request

# 需要导入模块: from scrapy.utils import reqser [as 别名]
# 或者: from scrapy.utils.reqser import request_from_dict [as 别名]
def _decode_request(self, encoded_request):
        """Decode an request previously encoded"""
        obj = self.serializer.loads(encoded_request)
        return request_from_dict(obj, self.spider) 
开发者ID:Python3WebSpider,项目名称:ScrapyRedisBloomFilter,代码行数:6,代码来源:queue.py

示例7: _decode_request

# 需要导入模块: from scrapy.utils import reqser [as 别名]
# 或者: from scrapy.utils.reqser import request_from_dict [as 别名]
def _decode_request(self, encoded_request):
        return request_from_dict(pickle.loads(encoded_request), self.spider) 
开发者ID:aaldaber,项目名称:Distributed-Multi-User-Scrapy-System-with-a-Web-UI,代码行数:4,代码来源:queue.py


注:本文中的scrapy.utils.reqser.request_from_dict方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。