diff --git a/debian/rules b/debian/rules index 2b41d8bdf..b8796e6e3 100755 --- a/debian/rules +++ b/debian/rules @@ -3,8 +3,3 @@ %: dh $@ - -override_dh_auto_install: - dh_auto_install - mkdir -p $(CURDIR)/debian/scrapy/usr/bin - mv $(CURDIR)/debian/tmp/usr/bin/scrapy-ws.py $(CURDIR)/debian/scrapy/usr/bin/scrapy-ws diff --git a/debian/scrapy.lintian-overrides b/debian/scrapy.lintian-overrides index a0eb88dd3..955e7def0 100644 --- a/debian/scrapy.lintian-overrides +++ b/debian/scrapy.lintian-overrides @@ -1,3 +1,2 @@ new-package-should-close-itp-bug -binary-without-manpage usr/bin/scrapy-ws extra-license-file usr/share/pyshared/scrapy/xlib/pydispatch/license.txt diff --git a/bin/scrapy-ws.py b/extras/scrapy-ws.py similarity index 82% rename from bin/scrapy-ws.py rename to extras/scrapy-ws.py index eecc10b41..675094708 100755 --- a/bin/scrapy-ws.py +++ b/extras/scrapy-ws.py @@ -1,8 +1,14 @@ #!/usr/bin/env python """ -Example script to control and monitor Scrapy using its web service. It only -provides a reduced functionality as its main purpose is to illustrate how to -write a web service client. Feel free to improve or write you own. +Example script to control a Scrapy server using its JSON-RPC web service. + +It only provides a reduced functionality as its main purpose is to illustrate +how to write a web service client. Feel free to improve or write you own. + +Also, keep in mind that the JSON-RPC API is not stable. The recommended way for +controlling a Scrapy server is through the execution queue (see the "queue" +command). + """ import sys, optparse, urllib @@ -19,7 +25,6 @@ def get_commands(): 'list-available': cmd_list_available, 'list-running': cmd_list_running, 'list-resources': cmd_list_resources, - 'list-extensions': cmd_list_extensions, 'get-global-stats': cmd_get_global_stats, 'get-spider-stats': cmd_get_spider_stats, } @@ -32,20 +37,20 @@ def cmd_help(args, opts): def cmd_run(args, opts): """run - schedule spider for running""" - jsonrpc_call(opts, 'manager/queue', 'append_spider_name', args[0]) + jsonrpc_call(opts, 'crawler/queue', 'append_spider_name', args[0]) def cmd_stop(args, opts): """stop - stop a running spider""" - jsonrpc_call(opts, 'manager/engine', 'close_spider', args[0]) + jsonrpc_call(opts, 'crawler/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'): + for x in json_get(opts, 'crawler/engine/open_spiders'): print x def cmd_list_available(args, opts): """list-available - list name of available spiders""" - for x in jsonrpc_call(opts, 'spiders', 'list'): + for x in jsonrpc_call(opts, 'crawler/spiders', 'list'): print x def cmd_list_resources(args, opts): @@ -53,11 +58,6 @@ def cmd_list_resources(args, opts): for x in json_get(opts, '')['resources']: print x -def cmd_list_extensions(args, opts): - """list-extensions - list enabled extensions""" - for x in jsonrpc_call(opts, 'extensions/enabled', 'keys'): - print x - def cmd_get_spider_stats(args, opts): """get-spider-stats - get stats of a running spider""" stats = jsonrpc_call(opts, 'stats', 'get_stats', args[0])