Search code examples
pythonurllib2scrapyurllibweb-crawler

Scrapyd: how to pass multiple setting values to scrapy service


Here is an example in scrapy document:

$ curl http://localhost:6800/schedule.json -d project=myproject -d spider=somespider -d setting=DOWNLOAD_DELAY=2 -d arg1=val1

But if I want to set both DOWNLOAD_DELAY = 2 and CONCURRENT_REQUESTS = 4, how to do? And how to do it with urllib2?


Solution

  • There are two solutions.

    First one, try this:

    $ curl http://localhost:6800/schedule.json -d project=myproject -d spider=somespider -d setting=DOWNLOAD_DELAY=2 -d setting=CONCURRENT_REQUESTS=4 -d arg1=val1
    

    Second one: New a file named settings.py in myproject folder(the directory with the pipelines.py and items.py). And put all your settings in it. Here's an example.