| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3432 人关注过本帖
标题:Python爬虫的一个问题
只看楼主 加入收藏
DeEP1996
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2017-12-20
收藏
 问题点数:0 回复次数:3 
Python爬虫的一个问题
C:\Users\Administrator>python
Python 3.6.3 |Anaconda, Inc.| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> response = requests.get('https://www.baidu.com')
Traceback (most recent call last):
  File "D:\Anaconda\install\lib\site-packages\urllib3\connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "D:\Anaconda\install\lib\site-packages\urllib3\util\connection.py", line 83, in create_connection
    raise err
  File "D:\Anaconda\install\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Anaconda\install\lib\site-packages\urllib3\connectionpool.py", line 595, in urlopen
    self._prepare_proxy(conn)
  File "D:\Anaconda\install\lib\site-packages\urllib3\connectionpool.py", line 816, in _prepare_proxy
    conn.connect()
  File "D:\Anaconda\install\lib\site-packages\urllib3\connection.py", line 284, in connect
    conn = self._new_conn()
  File "D:\Anaconda\install\lib\site-packages\urllib3\connection.py", line 150, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x000002F48FB77400>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Anaconda\install\lib\site-packages\requests\adapters.py", line 440, in send
    timeout=timeout
  File "D:\Anaconda\install\lib\site-packages\urllib3\connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "D:\Anaconda\install\lib\site-packages\urllib3\util\retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.baidu.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x000002F48FB77400>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Anaconda\install\lib\site-packages\requests\api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "D:\Anaconda\install\lib\site-packages\requests\api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "D:\Anaconda\install\lib\site-packages\requests\sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "D:\Anaconda\install\lib\site-packages\requests\sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "D:\Anaconda\install\lib\site-packages\requests\adapters.py", line 502, in send
    raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.baidu.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x000002F48FB77400>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。',)))
>>>

百度了很长时间,试过很多方法,也没有用,希望有大神帮助!!---来自Python小白
搜索更多相关主题的帖子: File install lib connection line 
2017-12-20 12:22
王立
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2018-1-5
收藏
得分:0 
目标拒绝应该是你爬的网页不支持爬虫
2018-01-05 08:46
南山浅悠然
Rank: 2
等 级:论坛游民
威 望:1
帖 子:53
专家分:92
注 册:2014-5-21
收藏
得分:0 
更改浏览器标识,用代理
收到的鲜花
  • 静夜思2018-03-31 01:46 送鲜花  1朵   附言:好帖送话
2018-03-27 12:05
carbine1985
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2018-4-10
收藏
得分:0 
百度支持requests的吧,我都爬到数据了
2018-04-10 22:50
快速回复:Python爬虫的一个问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024568 second(s), 11 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved