1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-23 04:03:55 +00:00

scrapy-ws.py: added stop command

This commit is contained in:
Pablo Hoffman 2010-06-11 18:14:01 -03:00
parent ed5d7561f9
commit 1b083911e6

View File

@ -15,6 +15,7 @@ def get_commands():
return {
'help': cmd_help,
'run': cmd_run,
'stop': cmd_stop,
'list-available': cmd_list_available,
'list-running': cmd_list_running,
'list-resources': cmd_list_resources,
@ -33,6 +34,10 @@ def cmd_run(args, opts):
"""run <spider_name> - schedule spider for running"""
jsonrpc_call(opts, 'manager/queue', 'append_spider_name', args[0])
def cmd_stop(args, opts):
"""stop <spider> - stop a running spider"""
jsonrpc_call(opts, 'manager/engine', 'close_spider', args[0])
def cmd_list_running(args, opts):
"""list-running - list running spiders"""
for x in json_get(opts, 'manager/engine/open_spiders'):