diff --git a/docs/topics/webservice.rst b/docs/topics/webservice.rst index 1b05d1ed9..87e5fa07f 100644 --- a/docs/topics/webservice.rst +++ b/docs/topics/webservice.rst @@ -194,7 +194,7 @@ To write a web service resource you should subclass the :class:`JsonResource` or http://localhost:6080/resource1/ -.. class:: scrapy.webservice.JsonRpcResource(target=None) +.. class:: scrapy.webservice.JsonRpcResource(crawler, target=None) This is a subclass of :class:`JsonResource` for implementing JSON-RPC resources. JSON-RPC resources wrap Python (Scrapy) objects around a diff --git a/extras/scrapy-ws.py b/extras/scrapy-ws.py index c5de44c52..d58465924 100755 --- a/extras/scrapy-ws.py +++ b/extras/scrapy-ws.py @@ -19,7 +19,6 @@ from scrapy.utils.jsonrpc import jsonrpc_client_call, JsonRpcError def get_commands(): return { 'help': cmd_help, - 'run': cmd_run, 'stop': cmd_stop, 'list-available': cmd_list_available, 'list-running': cmd_list_running, @@ -34,10 +33,6 @@ def cmd_help(args, opts): for _, func in sorted(get_commands().items()): print " ", func.__doc__ -def cmd_run(args, opts): - """run - schedule spider for running""" - jsonrpc_call(opts, 'crawler/queue', 'append_spider_name', args[0]) - def cmd_stop(args, opts): """stop - stop a running spider""" jsonrpc_call(opts, 'crawler/engine', 'close_spider', args[0]) diff --git a/scrapy/webservice.py b/scrapy/webservice.py index 58e3f2e0e..0cca1b1b0 100644 --- a/scrapy/webservice.py +++ b/scrapy/webservice.py @@ -44,7 +44,7 @@ class JsonRpcResource(JsonResource): target = self.get_target() try: newtarget = getattr(target, name) - return JsonRpcResource(newtarget) + return JsonRpcResource(self.crawler, newtarget) except AttributeError: return error.NoResource("No such child resource.")