Update scrapy settings based on spider property
问题 Is there a way with scrapy to dynamically set the settings for a spider given at runtime? I want to add an isDebug variable to my spider and depending on it's value I want to adjust log level, pipelines and various other settings ... When trying to manipulate the settings as said in the manual, like this: def from_crawler(cls, crawler): settings = crawler.settings settings['USER_AGENT'] = 'Overwridden-UA' I always get TypeError: Trying to modify an immutable Settings object 回答1: Settings