简体   繁体   English

Python 错误 SSL: WRONG_VERSION_NUMBER 在几天前工作的代码上

[英]Python ERROR SSL: WRONG_VERSION_NUMBER on code that worked few days earlier

Using google-search package ( https://pypi.org/project/googlesearch-python/ ) to open few google search results straight from cmd.使用 google-search package ( https://pypi.org/project/googlesearch-python/ ) 直接从 cmd 打开几个 google 搜索结果。 Worked fine few days ago.前几天工作正常。 Now that trying to launch the code I get SSL: WRONG_VERSION_NUMBER Error现在尝试启动代码我得到 SSL: WRONG_VERSION_NUMBER 错误

Any ideas how to fix?任何想法如何解决? And if ideas what caused the error that would be interesting.如果想法是什么导致了有趣的错误。

Code:代码:

from googlesearch import search
import webbrowser, sys

searching_for = input(("Input search words: "))

num_results = int(input("How many results : ") or "3")

result = search(searching_for)
for i in result[:num_results]:
    webbrowser.open(i)

ERROR raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.google.com', port=443): Max retries exceeded with url: /search?q=tim+ferriss&num=11&hl=en (Caused by ProxyError('Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#https-proxy-error-http-proxy' , SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:997)'))))错误引发 ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.google.com', port=443): url: /search?q=tim+ferriss&num=11&hl= en (Caused by ProxyError('Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html #https-proxy-error-http-proxy' , SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] 错误的版本号 (_ssl.c:997)'))))

I was able to reproduce the error and fix it using the following trick.我能够重现错误并使用以下技巧修复它。

try changing the next line of code to this:尝试将下一行代码更改为:

result = search(searching_for,proxy="http")

Caused by ProxyError('Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#https-proxy-error-http-proxy',

It says that you can try using HTTP on the URL.它说您可以尝试在 URL 上使用 HTTP。 But the search library that you are using, I don't see any options for changing the protocol.但是您正在使用的搜索库,我没有看到任何更改协议的选项。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python-Django [SSL:WRONG_VERSION_NUMBER]错误 - Python-Django [SSL: WRONG_VERSION_NUMBER] Error SSL:PYTHON 请求上的 WRONG_VERSION_NUMBER - SSL: WRONG_VERSION_NUMBER ON PYTHON REQUEST python 3 smtplib 异常:“SSL:WRONG_VERSION_NUMBER”登录到 Outlook - python 3 smtplib exception: 'SSL: WRONG_VERSION_NUMBER' logging in to outlook Python cassandra驱动程序-SSL:WRONG_VERSION_NUMBER - Python cassandra driver - SSL: WRONG_VERSION_NUMBER python 请求:(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] 错误的版本号 (_ssl.c:1123)')) - python requests: (SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)')) jupyter SSL:WRONG_VERSION_NUMBER - jupyter SSL: WRONG_VERSION_NUMBER 如何修复错误 ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] 版本号错误? - How to fix the error ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number? python elasticsearch elasticsearch.exceptions.SSLError: ConnectionError([SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)) - python elasticsearch elasticsearch.exceptions.SSLError: ConnectionError([SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)) Azure 函数 (Python) 无法使用 [SSL: WRONG_VERSION_NUMBER] 连接到 Azure MySQL 实例 - Azure Functions (Python) cannot connect to Azure MySQL instance with [SSL: WRONG_VERSION_NUMBER] 尝试重新包装套接字时出现错误 [SSL: WRONG_VERSION_NUMBER] - Error [SSL: WRONG_VERSION_NUMBER] when trying to re-wrap a socket
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM