python3 requests IP代理池出错

Traceback (most recent call last):
  File "E:/py1803/pachong/mimimovie/movies_spider.py", line 129, in 
    m.get_content()
  File "E:/py1803/pachong/mimimovie/movies_spider.py", line 65, in get_content
    for item in urlList:
  File "E:/py1803/pachong/mimimovie/movies_spider.py", line 43, in movies_info
    response = requests.get(url, proxies=proxy, headers=headers)
  File "D:\Python3.6\lib\site-packages\requests\api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "D:\Python3.6\lib\site-packages\requests\api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "D:\Python3.6\lib\site-packages\requests\sessions.py", line 499, in request
    prep.url, proxies, stream, verify, cert
  File "D:\Python3.6\lib\site-packages\requests\sessions.py", line 671, in merge_environment_settings
    no_proxy = proxies.get('no_proxy') if proxies is not None else None
AttributeError: 'list' object has no attribute 'get'

原因:

IP代理的变量的变量赋值错误,ip每次访问只能使用一个,而不是一个列表


解决方案:

查找ip代理池的值是否赋值正确,每次从列表随机提取出一个ip去访问网站

你可能感兴趣的:(爬虫)