Skip to content

Commit

Permalink
fix #15
Browse files Browse the repository at this point in the history
  • Loading branch information
lemisky committed Dec 23, 2021
1 parent e3aa818 commit 7f78477
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,11 @@ open('やめて.mp3', 'wb').write(tts)
2. `Translate`的最佳实践:
1. 准备好代理VPN,建议 **v2rayN** https://github.com/2dust/v2rayN
2. 使用 **clash** 进行代理,将会导致失败,参考 [#13](https://github.com/foyoux/pygtrans/issues/13)
2. 使用 **conda/miniconda** 的虚拟环境也可能导致失败 [#15](https://github.com/foyoux/pygtrans/issues/15)
2. ~~使用 **conda/miniconda** 的虚拟环境也可能导致失败 [#15](https://github.com/foyoux/pygtrans/issues/15)~~
3. 建议不要打开全局代理
4. `http` example:`Translate(proxies={"https": "http://localhost:10809"})`
5. `socks5` example: `Translate(proxies={"https": "socks5://localhost:10808"})`
6. **重要**:尽量一次性多翻译,减少请求次数,参考 [#13](https://github.com/foyoux/pygtrans/issues/13),比如一次性翻译 2000 / 5000 / 10000
7. **重要**:尽量一次性多翻译,减少请求次数,参考 [#13](https://github.com/foyoux/pygtrans/issues/13),比如一次性翻译 2000 / 5000 / 10000
8. **重要**:尽量一次性多翻译,减少请求次数,参考 [#13](https://github.com/foyoux/pygtrans/issues/13),比如一次性翻译 2000 / 5000 / 10000

1 change: 1 addition & 0 deletions pygtrans/Translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def __init__(
self.TTS_URL: str = f'{self.BASE_URL}/translate_tts'

if proxies is not None:
self.session.trust_env = False
self.session.proxies = proxies

def detect(self, q: str) -> Union[DetectResponse, Null]:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
requests
requests[socks]
pytest

0 comments on commit 7f78477

Please sign in to comment.