Skip to content

Commit 5b83443

Browse files
committed
update README regarding default params
1 parent 84dac7d commit 5b83443

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

README.rst

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,40 @@ Here's example of the things needed inside a Scrapy project's ``settings.py`` fi
6060
6161
TWISTED_REACTOR = "twisted.internet.asyncioreactor.AsyncioSelectorReactor"
6262
63+
To enable every request to be sent through Zyte API, you can set the following
64+
in the ``settings.py`` file:
65+
66+
.. code-block:: python
67+
68+
ZYTE_API_ENABLED = True
69+
70+
Moreover, it can also be set inside the spider as an attribute:
71+
72+
.. code-block:: python
73+
74+
class MySpider:
75+
zyte_api_enabled = True
76+
77+
The default parameters sent for every request could be declared in the ``settings.py``
78+
file or `any other settings <https://docs.scrapy.org/en/latest/topics/settings.html#populating-the-settings>`_
79+
as:
80+
81+
.. code-block:: python
82+
83+
ZYTE_API_DEFAULT_PARAMS = {
84+
"browserHtml": True,
85+
"geolocation": "US",
86+
}
87+
88+
You can see the full list of parameters in the `Zyte API Specification
89+
<https://docs.zyte.com/zyte-api/openapi.html#zyte-openapi-spec>`_.
90+
6391
Usage
6492
-----
6593

66-
Set the ``zyte_api`` `Request.meta
67-
<https://docs.scrapy.org/en/latest/topics/request-response.html#scrapy.http.Request.meta>`_
68-
key to download a request using Zyte API. Full list of parameters is provided in the
69-
`Zyte API Specification <https://docs.zyte.com/zyte-api/openapi.html#zyte-openapi-spec>`_.
94+
Setting ``ZYTE_API_ENABLED=True`` would enable Zyte API for every request. On the
95+
other hand, you could also control it on a per request basis by setting the
96+
``zyte_api`` key in `Request.meta <https://docs.scrapy.org/en/latest/topics/request-response.html#scrapy.http.Request.meta>`_.
7097

7198
.. code-block:: python
7299

0 commit comments

Comments
 (0)