Perform a request on a given urllib connection object taken from our pool. :param conn: a connection from one of our connection pools :param method: HTTP request method (such as GET, POST, PUT, etc.) :param url: The URL
(
self,
conn: BaseHTTPConnection,
method: str,
url: str,
body: _TYPE_BODY | None = None,
headers: typing.Mapping[str, str] | None = None,
retries: Retry | None = None,
timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT,
chunked: bool = False,
response_conn: BaseHTTPConnection | None = None,
preload_content: bool = True,
decode_content: bool = True,
enforce_content_length: bool = True,
)
| 375 | ) from err |
| 376 | |
| 377 | def _make_request( |
| 378 | self, |
| 379 | conn: BaseHTTPConnection, |
| 380 | method: str, |
| 381 | url: str, |
| 382 | body: _TYPE_BODY | None = None, |
| 383 | headers: typing.Mapping[str, str] | None = None, |
| 384 | retries: Retry | None = None, |
| 385 | timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, |
| 386 | chunked: bool = False, |
| 387 | response_conn: BaseHTTPConnection | None = None, |
| 388 | preload_content: bool = True, |
| 389 | decode_content: bool = True, |
| 390 | enforce_content_length: bool = True, |
| 391 | ) -> BaseHTTPResponse: |
| 392 | """ |
| 393 | Perform a request on a given urllib connection object taken from our |
| 394 | pool. |
| 395 | |
| 396 | :param conn: |
| 397 | a connection from one of our connection pools |
| 398 | |
| 399 | :param method: |
| 400 | HTTP request method (such as GET, POST, PUT, etc.) |
| 401 | |
| 402 | :param url: |
| 403 | The URL to perform the request on. |
| 404 | |
| 405 | :param body: |
| 406 | Data to send in the request body, either :class:`str`, :class:`bytes`, |
| 407 | an iterable of :class:`str`/:class:`bytes`, or a file-like object. |
| 408 | |
| 409 | :param headers: |
| 410 | Dictionary of custom headers to send, such as User-Agent, |
| 411 | If-None-Match, etc. If None, pool headers are used. If provided, |
| 412 | these headers completely replace any pool-specific headers. |
| 413 | |
| 414 | :param retries: |
| 415 | Configure the number of retries to allow before raising a |
| 416 | :class:`~urllib3.exceptions.MaxRetryError` exception. |
| 417 | |
| 418 | Pass ``None`` to retry until you receive a response. Pass a |
| 419 | :class:`~urllib3.util.retry.Retry` object for fine-grained control |
| 420 | over different types of retries. |
| 421 | Pass an integer number to retry connection errors that many times, |
| 422 | but no other types of errors. Pass zero to never retry. |
| 423 | |
| 424 | If ``False``, then retries are disabled and any exception is raised |
| 425 | immediately. Also, instead of raising a MaxRetryError on redirects, |
| 426 | the redirect response will be returned. |
| 427 | |
| 428 | :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. |
| 429 | |
| 430 | :param timeout: |
| 431 | If specified, overrides the default timeout for this one |
| 432 | request. It may be a float (in seconds) or an instance of |
| 433 | :class:`urllib3.util.Timeout`. |
| 434 |