lushan88a / google_trans_new

A free and unlimited python API for google translate.
MIT License
394 stars 171 forks source link

requests.exceptions.ConnectTimeout #9

Open RayestGeeta opened 3 years ago

RayestGeeta commented 3 years ago

hello, i get a problem. When i use the library, the error:

requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='translate.google.cn', port=443): Max retries exceeded with url:

lushan88a commented 3 years ago

You should try to use 'translator = google_translator(url_suffix="hk",timeout=5)'. This 'translate.google.cn' is used in China. If you still have problems, please post your code.

RayestGeeta commented 3 years ago

Hello:

from google_trans_new import google_translator

translator = google_translator(url_suffix="hk",timeout=5}) translate_text = translator.translate('hello',lang_tgt='zh') print(translate_text)

requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='translate.google.cn', port=443): Max retries exceeded with url: /_/TranslateWebserverUi/data/batchexecute (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x7f3a35b8c6d0>, 'Connection to ip timed out. (connect timeout=5)'))

The proxies is not convenient to disclose.

RayestGeeta commented 3 years ago

google_trans_new.google_trans_new.google_new_transError: Failed to connect. Probable cause: timeout

lushan88a commented 3 years ago

I think it's your proxy's problem. When I use an unavailable(or error) proxy, I also encounter this error.