Helper for regular HTTP request. Args: method: HTTP method of the request. url: Url of the request. data: Request body or form data. headers: HTTP headers of the message. form: If the data should be encoded as a form.
(
self,
method: str,
url: str,
data: Any = {},
headers: dict = {},
form: bool = False,
check_common: bool = True,
return_json: bool = True,
)
| 170 | raise RequestError(exc.message) |
| 171 | |
| 172 | async def request( |
| 173 | self, |
| 174 | method: str, |
| 175 | url: str, |
| 176 | data: Any = {}, |
| 177 | headers: dict = {}, |
| 178 | form: bool = False, |
| 179 | check_common: bool = True, |
| 180 | return_json: bool = True, |
| 181 | ) -> Any: |
| 182 | """ |
| 183 | Helper for regular HTTP request. |
| 184 | |
| 185 | Args: |
| 186 | method: HTTP method of the request. |
| 187 | url: Url of the request. |
| 188 | data: Request body or form data. |
| 189 | headers: HTTP headers of the message. |
| 190 | form: If the data should be encoded as a form. |
| 191 | check_common: If response data should be checked for errors using check_known_errors. |
| 192 | return_json: If the response should be parsed as JSON. |
| 193 | |
| 194 | Returns: |
| 195 | The JSON deserialized to a python object or bytes if ``json`` is ``False``. |
| 196 | """ |
| 197 | message = self.create_message(method, url, data, headers, form) |
| 198 | return await self.send_and_read_and_process(message, check_common, return_json) |
| 199 | |
| 200 | async def get( |
| 201 | self, |
no test coverage detected