-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy path__init__.py
More file actions
74 lines (66 loc) · 2.53 KB
/
__init__.py
File metadata and controls
74 lines (66 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from .utils import _NEEDS_EARLY_REACTOR
if _NEEDS_EARLY_REACTOR:
from scrapy.utils.reactor import install_reactor
install_reactor("twisted.internet.asyncioreactor.AsyncioSelectorReactor")
# Register web-poet serializers
from . import _serialization # noqa: F401
from ._annotations import ExtractFrom, actions, custom_attrs
from ._middlewares import (
ScrapyZyteAPIDownloaderMiddleware,
ScrapyZyteAPIRefererSpiderMiddleware,
ScrapyZyteAPISpiderMiddleware,
)
from ._page_inputs import Actions, Geolocation, Screenshot
from ._request_fingerprinter import ScrapyZyteAPIRequestFingerprinter
from ._session import (
SESSION_AGGRESSIVE_RETRY_POLICY as _SESSION_AGGRESSIVE_RETRY_POLICY,
)
from ._session import SESSION_DEFAULT_RETRY_POLICY as _SESSION_DEFAULT_RETRY_POLICY
from ._session import (
LocationSessionConfig,
ScrapyZyteAPISessionDownloaderMiddleware,
SessionConfig,
get_request_session_id,
is_session_init_request,
session_config,
)
from ._session import session_config_registry as _session_config_registry
from .addon import Addon
from .handler import ScrapyZyteAPIDownloadHandler
# We re-define the variables here for Sphinx to pick the documentation.
#: Alternative to the :ref:`default retry policy <default-retry-policy>` for
#: :ref:`session management <session>` that does not retry 520 responses.
SESSION_DEFAULT_RETRY_POLICY = _SESSION_DEFAULT_RETRY_POLICY
#: Alternative to the :ref:`aggresive retry policy <aggressive-retry-policy>`
#: for :ref:`session management <session>` that does not retry 520 and 521
#: responses.
#:
#: .. note:: When using python-zyte-api 0.5.2 or lower, this is the same as
#: :data:`~scrapy_zyte_api.SESSION_DEFAULT_RETRY_POLICY`.
SESSION_AGGRESSIVE_RETRY_POLICY = _SESSION_AGGRESSIVE_RETRY_POLICY
#: Instance of :class:`web_poet.rules.RulesRegistry` that holds :ref:`session
#: configs <session-configs>`.
session_config_registry = _session_config_registry
__all__ = [
"SESSION_AGGRESSIVE_RETRY_POLICY",
"SESSION_DEFAULT_RETRY_POLICY",
"Actions",
"Addon",
"ExtractFrom",
"Geolocation",
"LocationSessionConfig",
"ScrapyZyteAPIDownloadHandler",
"ScrapyZyteAPIDownloaderMiddleware",
"ScrapyZyteAPIRefererSpiderMiddleware",
"ScrapyZyteAPIRequestFingerprinter",
"ScrapyZyteAPISessionDownloaderMiddleware",
"ScrapyZyteAPISpiderMiddleware",
"Screenshot",
"SessionConfig",
"actions",
"custom_attrs",
"get_request_session_id",
"is_session_init_request",
"session_config",
"session_config_registry",
]