Skip to content

Commit

Permalink
docs: Add versionchanged admonitions to webservices
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jul 23, 2024
1 parent afc1f24 commit 340cc08
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.
Expand Down
28 changes: 28 additions & 0 deletions scrapyd/webservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 340cc08

Please sign in to comment.