@@ -6,22 +6,22 @@ Session management
66
77Zyte API provides powerful session APIs:
88
9- - :ref: `Client-managed sessions <zyte-api -session-id >` give you full control
9+ - :ref: `Client-managed sessions <zapi -session-id >` give you full control
1010 over session management.
1111
12- - :ref: `Server-managed sessions <zyte-api -session-contexts >` let Zyte API
12+ - :ref: `Server-managed sessions <zapi -session-contexts >` let Zyte API
1313 handle session management for you.
1414
1515When using scrapy-zyte-api, you can use these session APIs through the
1616corresponding Zyte API fields (:http: `request:session `,
1717:http: `request:sessionContext `).
1818
1919However, scrapy-zyte-api also provides its own session management API, similar
20- to that of :ref: `server-managed sessions <zyte-api -session-contexts >`, but
21- built on top of :ref: `client-managed sessions <zyte-api -session-id >`.
20+ to that of :ref: `server-managed sessions <zapi -session-contexts >`, but
21+ built on top of :ref: `client-managed sessions <zapi -session-id >`.
2222
2323scrapy-zyte-api session management offers some advantages over
24- :ref: `server-managed sessions <zyte-api -session-contexts >`:
24+ :ref: `server-managed sessions <zapi -session-contexts >`:
2525
2626- You can perform :ref: `session validity checks <session-check >`, so that the
2727 sessions of responses that do not pass those checks are refreshed, and the
@@ -35,11 +35,11 @@ scrapy-zyte-api session management offers some advantages over
3535 :ref: `optimize-sessions ` and :ref: `session-configs `.
3636
3737However, scrapy-zyte-api session management is not a replacement for
38- :ref: `server-managed sessions <zyte-api -session-contexts >` or
39- :ref: `client-managed sessions <zyte-api -session-id >`:
38+ :ref: `server-managed sessions <zapi -session-contexts >` or
39+ :ref: `client-managed sessions <zapi -session-id >`:
4040
41- - :ref: `Server-managed sessions <zyte-api -session-contexts >` offer a longer
42- life time than the :ref: `client-managed sessions <zyte-api -session-id >`
41+ - :ref: `Server-managed sessions <zapi -session-contexts >` offer a longer
42+ life time than the :ref: `client-managed sessions <zapi -session-id >`
4343 that scrapy-zyte-api session management uses, so as long as you do not need
4444 one of the scrapy-zyte-api session management features, server-managed
4545 sessions can be significantly more efficient (fewer total sessions needed
@@ -49,7 +49,7 @@ However, scrapy-zyte-api session management is not a replacement for
4949 website. With scrapy-zyte-api session management, you need to :ref: `handle
5050 optimization yourself <optimize-sessions>`.
5151
52- - :ref: `Client-managed sessions <zyte-api -session-id >` offer full control
52+ - :ref: `Client-managed sessions <zapi -session-id >` offer full control
5353 over session management, while scrapy-zyte-api session management removes
5454 some of that control to provide an easier API for supported use cases.
5555
@@ -68,7 +68,7 @@ override <session-configs>`.
6868.. _session-init-default :
6969
7070By default, scrapy-zyte-api will maintain up to 8 sessions per domain, each
71- initialized with a :ref: `browser request <zyte-api -browser >` targeting the URL
71+ initialized with a :ref: `browser request <zapi -browser >` targeting the URL
7272of the first request that will use the session. Sessions are automatically
7373rotated among requests, and refreshed as they expire or get banned. You can
7474customize most of this logic though request metadata, settings and
@@ -134,7 +134,7 @@ To change the :ref:`default session initialization parameters
134134 :reqmeta: `zyte_api_session_params ` request metadata key.
135135
136136 It works similarly to :http: `request:sessionContextParams ` from
137- :ref: `server-managed sessions <zyte-api -session-contexts >`, but it supports
137+ :ref: `server-managed sessions <zapi -session-contexts >`, but it supports
138138 arbitrary Zyte API parameters instead of a specific subset.
139139
140140 If it does not define a ``"url" ``, the URL of the request :ref: `triggering
@@ -210,7 +210,7 @@ initialization request.
210210If your session checking implementation relies on the response body (e.g. it
211211uses CSS or XPath expressions), you should make sure that you are getting one,
212212which might not be the case if you are mostly using :ref: `Zyte API automatic
213- extraction <zyte-api -extract>`, e.g. when using :doc: `Zyte spider templates
213+ extraction <zapi -extract>`, e.g. when using :doc: `Zyte spider templates
214214<zyte-spider-templates:index>`. For example, you can use
215215:setting: `ZYTE_API_AUTOMAP_PARAMS ` and :setting: `ZYTE_API_PROVIDER_PARAMS ` to
216216force :http: `request:browserHtml ` or :http: `request:httpResponseBody ` to be set
@@ -288,7 +288,7 @@ Here are some things you can try:
288288 (:setting: `ZYTE_API_SESSION_POOL_SIZE `). The more different sessions you
289289 use, the more slowly you send requests through each session.
290290
291- Mind, however, that :ref: `client-managed sessions <zyte-api -session-id >`
291+ Mind, however, that :ref: `client-managed sessions <zapi -session-id >`
292292 expire after `15 minutes since creation or 2 minutes since the last request
293293 <https://docs.zyte.com/zyte-api/usage/reference.html#operation/extract/request/session> `_.
294294 At a certain point, increasing :setting: `ZYTE_API_SESSION_POOL_SIZE `
@@ -298,7 +298,7 @@ Here are some things you can try:
298298 counterproductive.
299299
300300- By default, sessions are discarded as soon as an :ref: `unsuccessful
301- response <zyte-api -unsuccessful-responses>` is received.
301+ response <zapi -unsuccessful-responses>` is received.
302302
303303 However, on some websites sessions may remain valid even after a few
304304 unsuccessful responses. If that is the case, you might want to increase
@@ -308,9 +308,9 @@ Here are some things you can try:
308308If you do not need :ref: `session checking <session-check >` and your
309309:ref: `initialization parameters <session-init >` are only
310310:http: `request:browserHtml ` and :http: `request:actions `, :ref: `server-managed
311- sessions <zyte-api -session-contexts>` might be a more cost-effective choice, as
311+ sessions <zapi -session-contexts>` might be a more cost-effective choice, as
312312they live much longer than :ref: `client-managed sessions
313- <zyte-api -session-id>`.
313+ <zapi -session-id>`.
314314
315315
316316.. _session-configs :
@@ -371,7 +371,7 @@ To include cookies in session initialization requests, use
371371:http: `request:requestCookies ` in :ref: `session initialization parameters
372372<session-init>`. But mind that those cookies are only set during that request,
373373:ref: `they are not added to the session cookie jar
374- <zyte-api -session-cookie-jar>`.
374+ <zapi -session-cookie-jar>`.
375375
376376
377377Session retry policies
@@ -441,7 +441,7 @@ The following stats exist for scrapy-zyte-api session management:
441441
442442``scrapy-zyte-api/sessions/pools/{pool}/init/failed ``
443443 Number of times that initializing a session for pool ``{pool} `` resulted in
444- an :ref: `unsuccessful response <zyte-api -unsuccessful-responses >`.
444+ an :ref: `unsuccessful response <zapi -unsuccessful-responses >`.
445445
446446``scrapy-zyte-api/sessions/pools/{pool}/init/param-error ``
447447 Number of times that initializing a session for pool ``{pool} `` triggered
@@ -473,7 +473,7 @@ The following stats exist for scrapy-zyte-api session management:
473473
474474``scrapy-zyte-api/sessions/pools/{pool}/use/failed ``
475475 Number of times that a request that used a session from pool ``{pool} ``
476- got an :ref: `unsuccessful response <zyte-api -unsuccessful-responses >`.
476+ got an :ref: `unsuccessful response <zapi -unsuccessful-responses >`.
477477
478478``scrapy-zyte-api/sessions/use/disabled ``
479479 Number of processed requests for which session management was disabled.
0 commit comments