Use Cases:
import requests adder='http://127.0.0.1:6800' data = { 'project':'v1', 'version':'12379', 'setting':['ROBOTSTXT_OBEY=True','CONCURRENT_REQUESTS=32'] } resp = requests.post(adder,data=data)
Problem-solving ideas:
Version 1.2 document:
-
setting
(string, optional) - a Scrapy setting to use when running the spider
setting a string, then how do multiple strings.
Source by site-packages / scrapyd / webservice.py
class Schedule(WsResource): def render_POST(self, txrequest): args = native_stringify_dict(copy(txrequest.args), keys_only=False) settings = args.pop('setting', []) settings = dict(x.split('=', 1) for x in settings) args = dict((k, v[0]) for k, v in args.items()) project = args.pop('project') spider = args.pop('spider') version = args.get('_version', '') spiders = get_spider_list(project, version=version) if not spider in spiders: return {"status": "error", "message": "spider '%s' not found" % spider} args['settings'] = settings jobid = args.pop('jobid', uuid.uuid1().hex) args['_job'] = jobid self.root.scheduler.schedule(project, spider, **args) return {"node_name": self.root.nodename, "status": "ok", "jobid": jobid}
Setting can be found here is a list object, and which element is a character string must contain the = sign.
We try to pass this setting: [ 'DEBUG = True', 'HOST_NAME = axdda']
The results really. For more complex settings, next time there is a demand and then study it.