r"""All parameters except ``url`` are optional. :arg str url: URL to fetch :arg str method: HTTP method, e.g. "GET" or "POST" :arg headers: Additional HTTP headers to pass on the request :type headers: `~tornado.httputil.HTTPHeaders` or `dict` :arg body: HTTP
(
self,
url: str,
method: str = "GET",
headers: Optional[Union[Dict[str, str], httputil.HTTPHeaders]] = None,
body: Optional[Union[bytes, str]] = None,
auth_username: Optional[str] = None,
auth_password: Optional[str] = None,
auth_mode: Optional[str] = None,
connect_timeout: Optional[float] = None,
request_timeout: Optional[float] = None,
if_modified_since: Optional[Union[float, datetime.datetime]] = None,
follow_redirects: Optional[bool] = None,
max_redirects: Optional[int] = None,
user_agent: Optional[str] = None,
use_gzip: Optional[bool] = None,
network_interface: Optional[str] = None,
streaming_callback: Optional[Callable[[bytes], None]] = None,
header_callback: Optional[Callable[[str], None]] = None,
prepare_curl_callback: Optional[Callable[[Any], None]] = None,
proxy_host: Optional[str] = None,
proxy_port: Optional[int] = None,
proxy_username: Optional[str] = None,
proxy_password: Optional[str] = None,
proxy_auth_mode: Optional[str] = None,
allow_nonstandard_methods: Optional[bool] = None,
validate_cert: Optional[bool] = None,
ca_certs: Optional[str] = None,
allow_ipv6: Optional[bool] = None,
client_key: Optional[str] = None,
client_cert: Optional[str] = None,
body_producer: Optional[
Callable[[Callable[[bytes], None]], "Future[None]"]
] = None,
expect_100_continue: bool = False,
decompress_response: Optional[bool] = None,
ssl_options: Optional[Union[Dict[str, Any], ssl.SSLContext]] = None,
)
| 356 | ) |
| 357 | |
| 358 | def __init__( |
| 359 | self, |
| 360 | url: str, |
| 361 | method: str = "GET", |
| 362 | headers: Optional[Union[Dict[str, str], httputil.HTTPHeaders]] = None, |
| 363 | body: Optional[Union[bytes, str]] = None, |
| 364 | auth_username: Optional[str] = None, |
| 365 | auth_password: Optional[str] = None, |
| 366 | auth_mode: Optional[str] = None, |
| 367 | connect_timeout: Optional[float] = None, |
| 368 | request_timeout: Optional[float] = None, |
| 369 | if_modified_since: Optional[Union[float, datetime.datetime]] = None, |
| 370 | follow_redirects: Optional[bool] = None, |
| 371 | max_redirects: Optional[int] = None, |
| 372 | user_agent: Optional[str] = None, |
| 373 | use_gzip: Optional[bool] = None, |
| 374 | network_interface: Optional[str] = None, |
| 375 | streaming_callback: Optional[Callable[[bytes], None]] = None, |
| 376 | header_callback: Optional[Callable[[str], None]] = None, |
| 377 | prepare_curl_callback: Optional[Callable[[Any], None]] = None, |
| 378 | proxy_host: Optional[str] = None, |
| 379 | proxy_port: Optional[int] = None, |
| 380 | proxy_username: Optional[str] = None, |
| 381 | proxy_password: Optional[str] = None, |
| 382 | proxy_auth_mode: Optional[str] = None, |
| 383 | allow_nonstandard_methods: Optional[bool] = None, |
| 384 | validate_cert: Optional[bool] = None, |
| 385 | ca_certs: Optional[str] = None, |
| 386 | allow_ipv6: Optional[bool] = None, |
| 387 | client_key: Optional[str] = None, |
| 388 | client_cert: Optional[str] = None, |
| 389 | body_producer: Optional[ |
| 390 | Callable[[Callable[[bytes], None]], "Future[None]"] |
| 391 | ] = None, |
| 392 | expect_100_continue: bool = False, |
| 393 | decompress_response: Optional[bool] = None, |
| 394 | ssl_options: Optional[Union[Dict[str, Any], ssl.SSLContext]] = None, |
| 395 | ) -> None: |
| 396 | r"""All parameters except ``url`` are optional. |
| 397 | |
| 398 | :arg str url: URL to fetch |
| 399 | :arg str method: HTTP method, e.g. "GET" or "POST" |
| 400 | :arg headers: Additional HTTP headers to pass on the request |
| 401 | :type headers: `~tornado.httputil.HTTPHeaders` or `dict` |
| 402 | :arg body: HTTP request body as a string (byte or unicode; if unicode |
| 403 | the utf-8 encoding will be used) |
| 404 | :type body: `str` or `bytes` |
| 405 | :arg collections.abc.Callable body_producer: Callable used for |
| 406 | lazy/asynchronous request bodies. |
| 407 | It is called with one argument, a ``write`` function, and should |
| 408 | return a `.Future`. It should call the write function with new |
| 409 | data as it becomes available. The write function returns a |
| 410 | `.Future` which can be used for flow control. |
| 411 | Only one of ``body`` and ``body_producer`` may |
| 412 | be specified. ``body_producer`` is not supported on |
| 413 | ``curl_httpclient``. When using ``body_producer`` it is recommended |
| 414 | to pass a ``Content-Length`` in the headers as otherwise chunked |
| 415 | encoding will be used, and many servers do not support chunked |