poolmanager
PoolManager
Bases: RequestMethods
Allows for arbitrary requests while transparently keeping track of necessary connection pools for you.
:param num_pools: Number of connection pools to cache before discarding the least recently used pool.
:param headers: Headers to include with all requests, unless other headers are given explicitly.
:param **connection_pool_kw: Additional parameters are used to create fresh :class:urllib3.connectionpool.ConnectionPool
instances.
Example::
>>> manager = PoolManager(num_pools=2)
>>> r = manager.request('GET', 'http://google.com/')
>>> r = manager.request('GET', 'http://google.com/mail')
>>> r = manager.request('GET', 'http://yahoo.com/')
>>> len(manager.pools)
2
Source code in client/ayon_fusion/vendor/urllib3/poolmanager.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
|
clear()
Empty our store of pools and direct them all to close.
This will not affect in-flight connections, but they will not be re-used after completion.
Source code in client/ayon_fusion/vendor/urllib3/poolmanager.py
215 216 217 218 219 220 221 222 |
|
connection_from_context(request_context)
Get a :class:urllib3.connectionpool.ConnectionPool
based on the request context.
request_context
must at least contain the scheme
key and its value must be a key in key_fn_by_scheme
instance variable.
Source code in client/ayon_fusion/vendor/urllib3/poolmanager.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
|
connection_from_host(host, port=None, scheme='http', pool_kwargs=None)
Get a :class:urllib3.connectionpool.ConnectionPool
based on the host, port, and scheme.
If port
isn't given, it will be derived from the scheme
using urllib3.connectionpool.port_by_scheme
. If pool_kwargs
is provided, it is merged with the instance's connection_pool_kw
variable and used to create the new connection pool, if one is needed.
Source code in client/ayon_fusion/vendor/urllib3/poolmanager.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
|
connection_from_pool_key(pool_key, request_context=None)
Get a :class:urllib3.connectionpool.ConnectionPool
based on the provided pool key.
pool_key
should be a namedtuple that only contains immutable objects. At a minimum it must have the scheme
, host
, and port
fields.
Source code in client/ayon_fusion/vendor/urllib3/poolmanager.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
|
connection_from_url(url, pool_kwargs=None)
Similar to :func:urllib3.connectionpool.connection_from_url
.
If pool_kwargs
is not provided and a new pool needs to be constructed, self.connection_pool_kw
is used to initialize the :class:urllib3.connectionpool.ConnectionPool
. If pool_kwargs
is provided, it is used instead. Note that if a new pool does not need to be created for the request, the provided pool_kwargs
are not used.
Source code in client/ayon_fusion/vendor/urllib3/poolmanager.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
|
urlopen(method, url, redirect=True, **kw)
Same as :meth:urllib3.HTTPConnectionPool.urlopen
with custom cross-host redirect logic and only sends the request-uri portion of the url
.
The given url
parameter must be absolute, such that an appropriate :class:urllib3.connectionpool.ConnectionPool
can be chosen for it.
Source code in client/ayon_fusion/vendor/urllib3/poolmanager.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
|
ProxyManager
Bases: PoolManager
Behaves just like :class:PoolManager
, but sends all requests through the defined proxy, using the CONNECT method for HTTPS URLs.
:param proxy_url: The URL of the proxy to be used.
:param proxy_headers: A dictionary containing headers that will be sent to the proxy. In case of HTTP they are being sent with each request, while in the HTTPS/CONNECT case they are sent only once. Could be used for proxy authentication.
:param proxy_ssl_context: The proxy SSL context is used to establish the TLS connection to the proxy when using HTTPS proxies.
:param use_forwarding_for_https: (Defaults to False) If set to True will forward requests to the HTTPS proxy to be made on behalf of the client instead of creating a TLS tunnel via the CONNECT method. Enabling this flag means that request and response headers and content will be visible from the HTTPS proxy whereas tunneling keeps request and response headers and content private. IP address, target hostname, SNI, and port are always visible to an HTTPS proxy even when this flag is disabled.
Example
proxy = urllib3.ProxyManager('http://localhost:3128/') r1 = proxy.request('GET', 'http://google.com/') r2 = proxy.request('GET', 'http://httpbin.org/') len(proxy.pools) 1 r3 = proxy.request('GET', 'https://httpbin.org/') r4 = proxy.request('GET', 'https://twitter.com/') len(proxy.pools) 3
Source code in client/ayon_fusion/vendor/urllib3/poolmanager.py
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 |
|
urlopen(method, url, redirect=True, **kw)
Same as HTTP(S)ConnectionPool.urlopen, url
must be absolute.
Source code in client/ayon_fusion/vendor/urllib3/poolmanager.py
522 523 524 525 526 527 528 529 530 531 532 |
|