Skip to content

Commit 340fbdb

Browse files
committed
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
1 parent 0cb68af commit 340fbdb

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

docs/topics/webservice.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ To write a web service resource you should subclass the :class:`JsonResource` or
194194

195195
http://localhost:6080/resource1/
196196

197-
.. class:: scrapy.webservice.JsonRpcResource(target=None)
197+
.. class:: scrapy.webservice.JsonRpcResource(crawler, target=None)
198198

199199
This is a subclass of :class:`JsonResource` for implementing JSON-RPC
200200
resources. JSON-RPC resources wrap Python (Scrapy) objects around a

extras/scrapy-ws.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
def get_commands():
2121
return {
2222
'help': cmd_help,
23-
'run': cmd_run,
2423
'stop': cmd_stop,
2524
'list-available': cmd_list_available,
2625
'list-running': cmd_list_running,
@@ -35,10 +34,6 @@ def cmd_help(args, opts):
3534
for _, func in sorted(get_commands().items()):
3635
print " ", func.__doc__
3736

38-
def cmd_run(args, opts):
39-
"""run <spider_name> - schedule spider for running"""
40-
jsonrpc_call(opts, 'crawler/queue', 'append_spider_name', args[0])
41-
4237
def cmd_stop(args, opts):
4338
"""stop <spider> - stop a running spider"""
4439
jsonrpc_call(opts, 'crawler/engine', 'close_spider', args[0])

scrapy/webservice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def getChild(self, name, txrequest):
4444
target = self.get_target()
4545
try:
4646
newtarget = getattr(target, name)
47-
return JsonRpcResource(newtarget)
47+
return JsonRpcResource(self.crawler, newtarget)
4848
except AttributeError:
4949
return error.NoResource("No such child resource.")
5050

0 commit comments

Comments
 (0)