From 340cc0888576b5fbb0914774d6bce431b5f49100 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Tue, 23 Jul 2024 19:13:38 -0400 Subject: [PATCH] docs: Add versionchanged admonitions to webservices --- docs/news.rst | 5 +++-- scrapyd/webservice.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/docs/news.rst b/docs/news.rst index 78352d7f..af92ef9d 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -172,7 +172,7 @@ Fixed Added ~~~~~ -- Add ``items_url`` and ``log_url`` to the response from the :ref:`listjobs.json` webservice. (@mxdev88) +- Add ``log_url`` and ``items_url`` to the response from the :ref:`listjobs.json` webservice. (@mxdev88) - Scrapy 2.8 support. Scrapyd sets ``LOG_FILE`` and ``FEEDS`` command-line arguments, instead of ``SCRAPY_LOG_FILE`` and ``SCRAPY_FEED_URI`` environment variables. - Python 3.11 support. - Python 3.12 support. Use ``packaging.version.Version`` instead of ``distutils.LooseVersion``. (@pawelmhm) @@ -212,6 +212,7 @@ Added - Add :ref:`username` and :ref:`password` settings, for HTTP authentication. - Add :ref:`jobstorage` and :ref:`eggstorage` settings. +- Add a ``priority`` argument to the :ref:`schedule.json` webservice. - Add shortcut to jobs page to cancel a job using the :ref:`cancel.json` webservice. - Python 3.7, 3.8, 3.9, 3.10 support. @@ -259,7 +260,7 @@ Added - Webservice - Add the :ref:`daemonstatus.json` webservice. - - Add a ``_version`` argument to the :ref:`schedule.json` webservice. + - Add a ``_version`` argument to the :ref:`schedule.json` and :ref:`listspiders.json` webservices. - Add a ``jobid`` argument to the :ref:`schedule.json` webservice. - Add the run's PID to the response of the :ref:`listjobs.json` webservice. - Include full tracebacks from Scrapy when failing to get spider list. diff --git a/scrapyd/webservice.py b/scrapyd/webservice.py index c68806ce..fb288179 100644 --- a/scrapyd/webservice.py +++ b/scrapyd/webservice.py @@ -111,6 +111,11 @@ def delete(self, project, version=None): # WebserviceResource class WsResource(resource.Resource): + """ + .. versionchanged:: 1.1.0 + Add ``node_name`` to the response in all subclasses. + """ + json_encoder = json.JSONEncoder() def __init__(self, root): @@ -170,6 +175,13 @@ def render_GET(self, txrequest): class Schedule(WsResource): + """ + .. versionchanged:: 1.2.0 + Add ``_version`` and ``jobid`` parameters. + .. versionchanged:: 1.3.0 + Add ``priority`` parameter. + """ + @param("project") @param("spider") @param("_version", dest="version", required=False, default=None) @@ -264,6 +276,11 @@ def render_GET(self, txrequest, project): class ListSpiders(WsResource): + """ + .. versionchanged:: 1.2.0 + Add ``_version`` parameter. + """ + @param("project") @param("_version", dest="version", required=False, default=None) def render_GET(self, txrequest, project, version): @@ -312,6 +329,17 @@ def render_GET(self, txrequest, job, project): class ListJobs(WsResource): + """ + .. versionchanged:: 1.1.0 + Add ``start_time`` to running jobs in the response. + .. versionchanged:: 1.2.0 + Add ``pid`` to running jobs in the response. + .. versionchanged:: 1.3.0 + The ``project`` parameter is optional. Add ``project`` to all jobs in the response. + .. versionchanged:: 1.4.0 + Add ``log_url`` and ``items_url`` to finished jobs in the response. + """ + @param("project", required=False) def render_GET(self, txrequest, project): queues = self.root.scheduler.queues