File tree Expand file tree Collapse file tree 4 files changed +64
-13
lines changed Expand file tree Collapse file tree 4 files changed +64
-13
lines changed Original file line number Diff line number Diff line change 3636]
3737
3838pygments_style = "sphinx"
39+ pygments_dark_style = "monokai"
3940
4041templates_path = []
4142exclude_patterns = []
4445
4546intersphinx_mapping = {
4647 "python" : ("https://docs.python.org/3" , None ),
47- "requests" : ("https://docs.python-requests.org/en/master " , None ),
48+ "requests" : ("https://docs.python-requests.org/en/latest " , None ),
4849}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ API Reference
66
77 installation
88 nodes
9+ responses
910 exceptions
1011 logging
1112 transport
Original file line number Diff line number Diff line change 1+ Responses
2+ =========
3+
4+ .. py :currentmodule :: elastic_transport
5+
6+
7+ Response headers
8+ ----------------
9+
10+ .. autoclass :: elastic_transport::HttpHeaders
11+ :members: freeze
12+
13+ Metadata
14+ --------
15+
16+ .. autoclass :: ApiResponseMeta
17+ :members:
18+
19+ Response classes
20+ ----------------
21+
22+ .. autoclass :: ApiResponse
23+ :members:
24+
25+ .. autoclass :: BinaryApiResponse
26+ :members:
27+ :show-inheritance:
28+
29+ .. autoclass :: HeadApiResponse
30+ :members:
31+ :show-inheritance:
32+
33+ .. autoclass :: ListApiResponse
34+ :members:
35+ :show-inheritance:
36+
37+ .. autoclass :: ObjectApiResponse
38+ :members:
39+ :show-inheritance:
40+
41+ .. autoclass :: TextApiResponse
42+ :members:
43+ :show-inheritance:
Original file line number Diff line number Diff line change @@ -68,7 +68,15 @@ def __str__(self) -> str:
6868
6969
7070class HttpHeaders (MutableMapping [str , str ]):
71- """HTTP headers"""
71+ """HTTP headers
72+
73+ Behaves like a Python dictionary. Can be used like this::
74+
75+ headers = HttpHeaders()
76+ headers["foo"] = "bar"
77+ headers["foo"] = "baz"
78+ print(headers["foo"]) # prints "baz"
79+ """
7280
7381 __slots__ = ("_internal" , "_frozen" )
7482
@@ -180,26 +188,24 @@ def hide_auth(val: str) -> str:
180188
181189@dataclass
182190class ApiResponseMeta :
183- """Metadata that is returned from Transport.perform_request()"""
191+ """Metadata that is returned from Transport.perform_request()
192+
193+ :ivar int status: HTTP status code
194+ :ivar str http_version: HTTP version being used
195+ :ivar HttpHeaders headers: HTTP headers
196+ :ivar float duration: Number of seconds from start of request to start of response
197+ :ivar NodeConfig node: Node which handled the request
198+ :ivar typing.Optional[str] mimetype: Mimetype to be used by the serializer to decode the raw response bytes.
199+ """
184200
185- #: HTTP status code
186201 status : int
187-
188- #: HTTP version being used
189202 http_version : str
190-
191- #: HTTP headers
192203 headers : HttpHeaders
193-
194- #: Number of seconds from start of request to start of response
195204 duration : float
196-
197- #: Node which handled the request
198205 node : "NodeConfig"
199206
200207 @property
201208 def mimetype (self ) -> Optional [str ]:
202- """Mimetype to be used by the serializer to decode the raw response bytes."""
203209 try :
204210 content_type = self .headers ["content-type" ]
205211 return content_type .partition (";" )[0 ] or None
You can’t perform that action at this time.
0 commit comments