當前位置: 首頁>>代碼示例>>Python>>正文


Python FormRequest.headers['Accept']方法代碼示例

本文整理匯總了Python中scrapy.FormRequest.headers['Accept']方法的典型用法代碼示例。如果您正苦於以下問題:Python FormRequest.headers['Accept']方法的具體用法?Python FormRequest.headers['Accept']怎麽用?Python FormRequest.headers['Accept']使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scrapy.FormRequest的用法示例。


在下文中一共展示了FormRequest.headers['Accept']方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __repair_times_request_from_options

# 需要導入模塊: from scrapy import FormRequest [as 別名]
# 或者: from scrapy.FormRequest import headers['Accept'] [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['Accept'] [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['Accept']方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。