mirror of https://github.com/scrapy/scrapy.git
fixed bug in json-rpc webservice reported in https://groups.google.com/d/topic/scrapy-users/qgVBmFybNAQ/discussion. also removed no longer supported 'run' command from extras/scrapy-ws.py
This commit is contained in:
parent
abcac4fcbd
commit
9c3b9f2968
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <spider_name> - schedule spider for running"""
|
||||
jsonrpc_call(opts, 'crawler/queue', 'append_spider_name', args[0])
|
||||
|
||||
def cmd_stop(args, opts):
|
||||
"""stop <spider> - stop a running spider"""
|
||||
jsonrpc_call(opts, 'crawler/engine', 'close_spider', args[0])
|
||||
|
|
|
|||
|
|
@ -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.")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue