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


Python FormRequest.headers['X-Requested-With']方法代码示例

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


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

示例1: __repair_times_request_from_options

# 需要导入模块: from scrapy import FormRequest [as 别名]
# 或者: from scrapy.FormRequest import headers['X-Requested-With'] [as 别名]
 def __repair_times_request_from_options(self, item):
     url = '/vehicle/component/repair-times/variant'
     url = 'https://' + self.allowed_domains[0] + url
     request = FormRequest(
         url = url, formdata = {'item_id': item['item_id']}
     )
     request.headers['Content-Type'] = 'application/x-www-form-urlencoded'
     request.headers['Accept'] = '*/*'
     request.headers['X-Requested-With'] = 'XMLHttpRequest'
     request.method = 'POST'
     request.dont_filter = True
     request.meta['option'] = item
     request.callback = self.going_to_repair_times
     self.__prepare_request(request)
     return request
开发者ID:gerich,项目名称:autodata,代码行数:17,代码来源:working.py

示例2: __options_request

# 需要导入模块: from scrapy import FormRequest [as 别名]
# 或者: from scrapy.FormRequest import headers['X-Requested-With'] [as 别名]
    def __options_request(self, code):
        url = 'https://workshop.autodata-group.com/engine-code-form-api'

        request = FormRequest(
            url = url,
            callback = self.going_to_options_or_repair_times,
            formdata = {
                'vehicle_id': code['mecnid'],
                'engine_id': code['code'],
                'engine_name': code['code'],
                'back': ',/vehicle/component/rt&module=RT',
            },
            meta = {
                'series': code,
            },
            dont_filter = True
        )
        self.__prepare_request(request)
        request.method = 'POST'
        request.headers['Content-Type'] = 'application/x-www-form-urlencoded'
        request.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01'
        request.headers['X-Requested-With'] = 'XMLHttpRequest'
        request.meta['code'] = code
        return request
开发者ID:gerich,项目名称:autodata,代码行数:26,代码来源:working.py


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