是否可以在同一Scrapy蜘蛛中为不同的请求设置不同的设置?

时间:2018-10-20 00:41:36

标签: python web-scraping scrapy scrapy-spider crawlera

我只想对Scrapy蜘蛛中的某些请求使用Crawlera。因此,我想针对不同的请求分别设置<template> <v-dialog :value="createToggle" @input="onCancel" persistent :fullscreen="$vuetify.breakpoint.xsOnly" :max-width="dialogWidth"> <v-card> <v-toolbar fixed flat> <v-toolbar-title>Title</v-toolbar-title> <v-spacer></v-spacer> <v-btn icon> <v-icon class="heading grey--text text--darken-4">close</v-icon> </v-btn> </v-toolbar> <v-divider></v-divider> <v-card-text> <v-form ref="form"> <v-container> <v-layout row wrap> <v-subheader class=""> Section </v-subheader> <v-flex xs12 v-for="n in 20"> <v-text-field label="Field Name" outline > </v-text-field> </v-flex> </v-layout> </v-container> </v-form> </v-card-text> <v-card-actions> <v-btn>Cancel</v-btn> <v-btn>Save</v-btn> </v-card-actions> </v-card> </v-dialog> </template> 。有可能吗?

1 个答案:

答案 0 :(得分:1)

您可以使用dont_proxy中的meta键来处理不想使用Crawlera的请求。例如

# Supposing you have crawlera enabled in `settings.py`
yield scrapy.Request(
    url, 
    meta={"dont_proxy": True}, 
    callback=self.parse
)