zoukankan      html  css  js  c++  java
  • urllib3 PoolManager

    A pool manager is an abstraction for a collection of ConnectionPools.
    If you need to make requests to multiple hosts, then you can use a PoolManager, which takes care of maintaining
    your pools so you don’t have to.

    from urllib3 import PoolManager
    
    
    manager = PoolManager(10)
    res = manager.request('GET', 'baidu.com')
    print(res.status)
    print(res.data)

    The PoolManager uses a Least Recently Used (LRU) policy for discarding old pools. That is, if you set the PoolManager
    num_pools to 10, then after making requests to 11 or more different hosts, the least recently used pools will be
    cleaned up eventually.
    Cleanup of stale pools does not happen immediately but can be forced when used as a context manager.

    with PoolManager(10) as manager:
        res = manager.request('GET', 'baidu.com')
        res = manager.request('GET', 'bing.com')

    API

  • 相关阅读:
    招聘.NET开发人员
    SQL 2005 SSIS 导入数据效率问题
    用户控件使用事件与调用页面交互
    使用sql语句删除标识列属性
    poj1520
    poj1476
    poj1363
    poj1477
    poj1312
    大端法小端法与union
  • 原文地址:https://www.cnblogs.com/shadowwalker/p/5283372.html
Copyright © 2011-2022 走看看