Skip to content

Commit eaedc4d

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

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

README.rst

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,39 @@ 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 ``setings.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 as:
79+
80+
.. code-block:: python
81+
82+
ZYTE_API_DEFAULT_PARAMS = {
83+
"browserHtml": True,
84+
"geolocation": "US",
85+
}
86+
87+
You can see the full list of parameters in the `Zyte API Specification
88+
<https://docs.zyte.com/zyte-api/openapi.html#zyte-openapi-spec>`_.
89+
6390
Usage
6491
-----
6592

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>`_.
93+
Setting ``ZYTE_API_ENABLED=True`` would enable Zyte API for every request. On the
94+
other hand, you could also control it on a per request basis by setting the
95+
``zyte_api`` key in `Request.meta <https://docs.scrapy.org/en/latest/topics/request-response.html#scrapy.http.Request.meta>`_.
7096

7197
.. code-block:: python
7298

0 commit comments

Comments
 (0)