python - 如何将代理添加到 quickstart.py-python
问题描述
我按照教程的步骤执行quickstart.py,他会报错。我很确定它与我所在的代理有关,所以我特别想知道如何将我的代理添加到 quickstart.py 以及如何添加它是正确的。报错信息如下,望解答,谢谢!
Traceback (most recent call last):
File "D:\Python\lib\site-packages\urllib3\connectionpool.py", line 696, in urlopen
self._prepare_proxy(conn)
File "D:\Python\lib\site-packages\urllib3\connectionpool.py", line 964, in _prepare_proxy
conn.connect()
File "D:\Python\lib\site-packages\urllib3\connection.py", line 359, in connect
conn = self._connect_tls_proxy(hostname, conn)
File "D:\Python\lib\site-packages\urllib3\connection.py", line 506, in _connect_tls_proxy
ssl_context=ssl_context,
File "D:\Python\lib\site-packages\urllib3\util\ssl_.py", line 450, in ssl_wrap_socket
sock, context, tls_in_tls, server_hostname=server_hostname
File "D:\Python\lib\site-packages\urllib3\util\ssl_.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "D:\Python\lib\ssl.py", line 423, in wrap_socket
session=session
File "D:\Python\lib\ssl.py", line 870, in _create
self.do_handshake()
File "D:\Python\lib\ssl.py", line 1139, in do_handshake
self._sslobj.do_handshake()
OSError: [Errno 0] Error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Python\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "D:\Python\lib\site-packages\urllib3\connectionpool.py", line 756, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "D:\Python\lib\site-packages\urllib3\util\retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='oauth2.googleapis.com', port=443): Max retries exceeded with url: /token (Caused by ProxyError('Cannot connect to proxy.', OSError(0, 'Error')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/2021-0/Project/eliis_arno/RpaChangeOrder/test/quickstart.py", line 47, in <module>
main()
File "D:/2021-0/Project/eliis_arno/RpaChangeOrder/test/quickstart.py", line 28, in main
creds = flow.run_local_server(port=0)
File "D:\Python\lib\site-packages\google_auth_oauthlib\flow.py", line 479, in run_local_server
self.fetch_token(authorization_response=authorization_response)
File "D:\Python\lib\site-packages\google_auth_oauthlib\flow.py", line 288, in fetch_token
return self.oauth2session.fetch_token(self.client_config["token_uri"], **kwargs)
File "D:\Python\lib\site-packages\requests_oauthlib\oauth2_session.py", line 344, in fetch_token
**request_kwargs
File "D:\Python\lib\site-packages\requests_oauthlib\oauth2_session.py", line 516, in request
method, url, headers=headers, data=data, **kwargs
File "D:\Python\lib\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "D:\Python\lib\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "D:\Python\lib\site-packages\requests\adapters.py", line 510, in send
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='oauth2.googleapis.com', port=443): Max retries exceeded with url: /token (Caused by ProxyError('Cannot connect to proxy.', OSError(0, 'Error')))
解决方案
推荐阅读
- vim - 如何命名/重命名终端缓冲区?
- unity3d - 如何使用 Vuforia 使 GameObjects 使用物理来相互交互?
- r - FUN(X[[i]], ...) 中的错误:找不到对象“值” - 不是拼写错误
- python - 用熊猫平滑曲线并插值不修改数据
- amazon-web-services - 如何获取 AWS 中安全组的 ARN
- haskell - 制作对象 Haskell
- apache-spark - 从 Azure Eventhub => StreamingQueryException 读取 Spark:输入字节数组有错误的 4 字节结束单元
- vba - 如何在表单上显示 MS Access 表格附件或存储在 SharePoint 位置的图像?
- snowflake-cloud-data-platform - 未创建雪花 odbc 日志文件
- javascript - three.js 在占位符网格/世界坐标中创建文本?