def set_proxy_pool(self, proxies, auth=None, https=True):
from random import choice<EOL>if https:<EOL><INDENT>self.proxies = [{'<STR_LIT:http>': p, '<STR_LIT>': p} for p in proxies]<EOL><DEDENT>else:<EOL><INDENT>self.proxies = [{'<STR_LIT:http>': p} for p in proxies]<EOL><DEDENT>def get_with_random_proxy(url, **kwargs):<EOL><INDENT>proxy = choice(self.proxies)<EOL>kwargs['<STR_LIT>'] = proxy<EOL>if auth:<EOL><INDENT>kwargs['<STR_LIT>'] = auth<EOL><DEDENT>return self._session.original_get(url, **kwargs)<EOL><DEDENT>def post_with_random_proxy(url, *args, **kwargs):<EOL><INDENT>proxy = choice(self.proxies)<EOL>kwargs['<STR_LIT>'] = proxy<EOL>if auth:<EOL><INDENT>kwargs['<STR_LIT>'] = auth<EOL><DEDENT>return self._session.original_post(url, *args, **kwargs)<EOL><DEDENT>self._session.original_get = self._session.get<EOL>self._session.get = get_with_random_proxy<EOL>self._session.original_post = self._session.post<EOL>self._session.post = post_with_random_proxy<EOL>
设置代理池

        :param proxies: proxy列表, 形如 ``["ip1:port1", "ip2:port2"]``
        :param auth: 如果代理需要验证身份, 通过这个参数提供, 比如
        :param https: 默认为 True, 传入 False 则不设置 https 代理
        .. code-block:: python

              from requests.auth import HTTPProxyAuth
              auth = HTTPProxyAuth('laike9m', '123')
        :说明:
             每次 GET/POST 请求会随机选择列表中的代理