Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我的代理服务器是socks5协议的,似乎翻译不起来 #13

Closed
cloudyskyy opened this issue Oct 22, 2021 · 8 comments
Closed

我的代理服务器是socks5协议的,似乎翻译不起来 #13

cloudyskyy opened this issue Oct 22, 2021 · 8 comments

Comments

@cloudyskyy
Copy link

cloudyskyy commented Oct 22, 2021

我用的是shadowsocks,查了下是socks5协议,端口是1080,所以改成了以下,
client = Translate(target='en', proxies={'socks5:': 'socks5://localhost:1080'}, domain='com'),但是连接不起来。。翻译不了,能否请教下该如何修改

@lemisky
Copy link
Member

lemisky commented Oct 23, 2021

可以参考: #12

client = Translate(target='en', proxies={'https': 'socks5://localhost:1080'}, domain='com')

@lemisky
Copy link
Member

lemisky commented Oct 23, 2021

需要安装 pip install -U requests[socks]

@lemisky
Copy link
Member

lemisky commented Oct 23, 2021

image

@cloudyskyy
Copy link
Author

cloudyskyy commented Oct 23, 2021

谢谢你的及时回答,但是我实在太小白了,依然没有研究出来怎么办。。这是我的小飞机设置页面,然后我开了全局代理
image
修改成
client = Translate(target='en', proxies={'https': 'socks5://localhost:1080'}, domain='com')
image
然后run了后迟迟没有结果
image
最后错误:requests.exceptions.SSLError: HTTPSConnectionPool(host='translate.google.com', port=443): Max retries exceeded with url: /translate_a/t?tl=en&sl=auto&ie=UTF-8&oe=UTF-8&client=at&dj=1&format=html&v=1.0 (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1091)')))
能否请教一下正确的正确的设置应该是怎样的,我对网络这块知识太匮乏了。。不好意思了

@lemisky
Copy link
Member

lemisky commented Oct 23, 2021

加我微信吧: lemisky

1 similar comment
@lemisky
Copy link
Member

lemisky commented Oct 23, 2021

加我微信吧: lemisky

@cloudyskyy
Copy link
Author

cloudyskyy commented Oct 23, 2021

帮我解决了,牛逼

@Lamcoding
Copy link

经作者大大的耐心帮助,遇到了相同的问题,并最终解决了。

首先是犯下罪恶的clash(滑稽), 建议在开代理时不要尝试clash,这是我的问题的根源
然后就是对于翻译请求的补充,最好把要翻译的内容放在一个字符串列表里,一次翻译多个语句或文档,以免请求过于频繁被封

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants