MCPcopy
hub / github.com/scrapy/scrapy / Request

Class Request

scrapy/http/request/__init__.py:84–404  ·  view source on GitHub ↗

Represents an HTTP request, which is usually generated in a Spider and executed by the Downloader, thus generating a :class:`~scrapy.http.Response`.

Source from the content-addressed store, hash-verified

82
83
84class Request(object_ref):
85 """Represents an HTTP request, which is usually generated in a Spider and
86 executed by the Downloader, thus generating a :class:`~scrapy.http.Response`.
87 """
88
89 __attrs_and_slots = ("callback", "dont_filter", "errback", "method", "priority")
90 attributes: tuple[str, ...] = (
91 "url",
92 "headers",
93 "body",
94 "cookies",
95 "meta",
96 "encoding",
97 "flags",
98 "cb_kwargs",
99 *__attrs_and_slots,
100 )
101 """A tuple of :class:`str` objects containing the name of all public
102 attributes of the class that are also keyword parameters of the
103 ``__init__()`` method.
104
105 Currently used by :meth:`.Request.replace`, :meth:`.Request.to_dict` and
106 :func:`~scrapy.utils.request.request_from_dict`.
107 """
108
109 __slots__ = (
110 "__weakref__",
111 "_body",
112 "_cb_kwargs",
113 "_cookies",
114 "_encoding",
115 "_flags",
116 "_headers",
117 "_meta",
118 "_url",
119 *__attrs_and_slots,
120 )
121 del __attrs_and_slots
122
123 def __init__(
124 self,
125 url: str,
126 callback: CallbackT | None = None,
127 method: str = "GET",
128 headers: Mapping[AnyStr, Any] | Iterable[tuple[AnyStr, Any]] | None = None,
129 body: bytes | str | None = None,
130 cookies: CookiesT | None = None,
131 meta: dict[str, Any] | None = None,
132 encoding: str = "utf-8",
133 priority: int = 0,
134 dont_filter: bool = False,
135 errback: Callable[[Failure], Any] | None = None,
136 flags: list[str] | None = None,
137 cb_kwargs: dict[str, Any] | None = None,
138 ) -> None:
139 self._encoding: str = encoding # this one has to be set first
140 self.method: str = str(method).upper()
141 self._set_url(url)

Callers 15

fetchMethod · 0.90
_build_requestMethod · 0.90
startMethod · 0.90
startMethod · 0.90
_parse_sitemapMethod · 0.90
followMethod · 0.90
set_spiderclsMethod · 0.90
startMethod · 0.90
runMethod · 0.90
runMethod · 0.90
get_media_requestsMethod · 0.90
get_media_requestsMethod · 0.90

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…