回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>所以我知道下面有很多代码要看,但我完全被难住了,因为我在使用python时从来没有遇到过这样的问题。在</p>
<p>我希望使用“请求”模块来帮助我加快一些基于web的工作活动。我根据开发人员的要求下载了zipball并运行了“设置.py将其安装到“site packages”目录中。在</p>
<p>我已经验证了所有的内容确实在它应该的位置,理论上我应该能够导入它然后使用它,但是当我输入任何代码来提出一个新的请求时,比如:<br/>
r=请求.get('<a href="https://api.github.com/events" rel="nofollow">https://api.github.com/events</a>')
下面是大量的错误,我一个字也听不懂。在</p>
<pre><code> Traceback (most recent call last):
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\packages\urllib3\connection.py", line 135, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\packages\urllib3\util\connection.py", line 90, in create_connection
raise err
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\packages\urllib3\util\connection.py", line 80, in create_connection
sock.connect(sa)
**ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it**
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\packages\urllib3\connectionpool.py", line 554, in urlopen
self._prepare_proxy(conn)
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\packages\urllib3\connectionpool.py", line 748, in _prepare_proxy
conn.connect()
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\packages\urllib3\connection.py", line 215, in connect
conn = self._new_conn()
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\packages\urllib3\connection.py", line 144, in _new_conn
self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x03908510>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\adapters.py", line 370, in send
timeout=timeout
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\packages\urllib3\connectionpool.py", line 609, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\packages\urllib3\util\retry.py", line 271, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /events (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x03908510>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',)))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
r = requests.get('https://api.github.com/events')
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\api.py", line 69, in get
return request('get', url, params=params, **kwargs)
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\api.py", line 50, in request
response = session.request(method=method, url=url, **kwargs)
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "C:\Users\Dakota\AppData\Local\Programs\Python\Python35-32\lib\site-packages\requests-2.8.1-py3.5.egg\requests\adapters.py", line 431, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /events (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x03908510>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',)))
</code></pre>