Skip to main content
Version: 0.3.x

SafePoolManager

ClassPrivateContextSource

with syncstream.webtools.SafePoolManager(
num_pools: int = 10,
headers: dict[str, str] | None = None,
**connection_pool_kw
) as pool:
pool: SafePoolManager

A wrapped urllib3.PoolManager with context supported.

danger

This is a private class. Should not be used by users.

Arguments

See

https://urllib3.readthedocs.io/en/stable/reference/urllib3.poolmanager.html

Example

Use context to manage connections

use_pool_context.py
from syncstream.webtools import SafePoolManager


with SafePoolManager() as pool:
with pool.request("get", "https://google.com") as req:
# req is already managed by SafeRequest.
print(req.status)