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 36
36
]
37
37
38
38
pygments_style = "sphinx"
39
+ pygments_dark_style = "monokai"
39
40
40
41
templates_path = []
41
42
exclude_patterns = []
44
45
45
46
intersphinx_mapping = {
46
47
"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 ),
48
49
}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ API Reference
6
6
7
7
installation
8
8
nodes
9
+ responses
9
10
exceptions
10
11
logging
11
12
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:
68
68
69
69
70
70
class 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
+ """
72
80
73
81
__slots__ = ("_internal" , "_frozen" )
74
82
@@ -180,26 +188,24 @@ def hide_auth(val: str) -> str:
180
188
181
189
@dataclass
182
190
class 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
+ """
184
200
185
- #: HTTP status code
186
201
status : int
187
-
188
- #: HTTP version being used
189
202
http_version : str
190
-
191
- #: HTTP headers
192
203
headers : HttpHeaders
193
-
194
- #: Number of seconds from start of request to start of response
195
204
duration : float
196
-
197
- #: Node which handled the request
198
205
node : "NodeConfig"
199
206
200
207
@property
201
208
def mimetype (self ) -> Optional [str ]:
202
- """Mimetype to be used by the serializer to decode the raw response bytes."""
203
209
try :
204
210
content_type = self .headers ["content-type" ]
205
211
return content_type .partition (";" )[0 ] or None
You can’t perform that action at this time.
0 commit comments