Skip to content

Commit

Permalink
feat: Default webservices can be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jul 26, 2024
1 parent 0e1723d commit 3064a28
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,13 @@ If you want to add a webservice (endpoint), add, for example:
You can use code for webservices in `webservice.py <https://github.com/scrapy/scrapyd/blob/master/scrapyd/webservice.py>`__ as inspiration.

To remove a :ref:`default webservice<config-default>`, set it to empty:

.. code-block:: ini
[services]
daemonstatus.json =
.. _config-settings:

settings section (scrapy.cfg)
Expand Down
5 changes: 3 additions & 2 deletions scrapyd/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ def __init__(self, config, app):
self.putChild(b"items", File(self.items_dir, "text/plain"))

for service_name, service_path in config.items("services", default=[]):
service_cls = load_object(service_path)
self.putChild(service_name.encode(), service_cls(self))
if service_path:
service_cls = load_object(service_path)
self.putChild(service_name.encode(), service_cls(self))

# Add web UI last, since its behavior can depend on others' presence.
self.putChild(b"", Home(self))
Expand Down

0 comments on commit 3064a28

Please sign in to comment.