Comments (30)
ok, lesson learned, if you put a hash symbol in to denote a comment, it shows up as large bold text, sorry about that.
from google_trans_new.
I get the same error, is there any solution?
from google_trans_new.
search on the internet: free http proxy ... and you will find a number of websites that provide list of proxies (these are public proxies with no security)
from google_trans_new.
Same error. I am using it for batch (size=50) translation from English to Chinese.
from google_trans_new.
Same here, have to change IP using a VPN quite often
from google_trans_new.
Is there any word on the actual limit of translation? Is it in terms of character count/entity count/...? This would help greatly in tryafter loops.
from google_trans_new.
I found a solution, which i don't know how worked. But it is working for me. Add random valid proxy from the internet in the Google Translator function as it is asked in the library. After executing script one time,(if it works) remove that proxy and this library will work as it was working before.
I don't know why but this method is working for me every time I am being blocked by tts API.
from google_trans_new.
Can you give us a short description of what you mean using some code? I am a bit confused on how to add the random proxy.
from google_trans_new.
Can you give us a short description of what you mean using some code? I am a bit confused on how to add the random proxy.
from google_trans_new.
translator = google_translator(url_suffix="hk",timeout=5,proxies={'http':'xxx.xxx.xxx.xxx:xxxx','https':'xxx.xxx.xxx.xxx:xxxx'})
when you call google translator function, add some random proxy which is valid and working. You can try from the internet.
If proxy is valid, library will work. After that, remove it from the function and it will work fine.
I tried my dedicated proxies (paid proxies) and those are working in this function.
from google_trans_new.
Where can I find a random proxy? Not familiar with this. Any help would be appreciated.
from google_trans_new.
ConnectTimeout: HTTPSConnectionPool(host='translate.google.cn', port=443): Max retries exceeded with url: /_/TranslateWebserverUi/data/batchexecute (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x000001C44C912730>, 'Connection to (proxy) timed out. (connect timeout=5)')).
How do I avoid this?
from google_trans_new.
ConnectTimeout: HTTPSConnectionPool(host='translate.google.cn', port=443): Max retries exceeded with url: /_/TranslateWebserverUi/data/batchexecute (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x000001C44C912730>, 'Connection to (proxy) timed out. (connect timeout=5)')).
How do I avoid this?
Try to increase timeout
from google_trans_new.
Where can I find a random proxy? Not familiar with this. Any help would be appreciated.
Have you gotten a proxy ? I am too searching for one
from google_trans_new.
you can get 10 free proxies after sign up on this website as well: https://www.webshare.io/
from google_trans_new.
search on the internet: free http proxy ... and you will find a number of websites that provide list of proxies (these are public proxies with no security)
I tried this approach but now I'm getting another error:
Failed to connect. Probable cause: timeout
Although I put quite long timeout. Are you facing the same problem?
from google_trans_new.
search on the internet: free http proxy ... and you will find a number of websites that provide list of proxies (these are public proxies with no security)
I tried this approach but now I'm getting another error:
Failed to connect. Probable cause: timeoutAlthough I put quite long timeout. Are you facing the same problem?
that is because the proxy you are using may not have a good reputation. try to use your own dedicated proxy. you can get 10 free dedicated proxies on sign up on https://www.webshare.io/.
from google_trans_new.
Slightly different approach... I was getting locked out for "too many requests" (it does eventually reset... 8 hours or so if I remember correctly). I just slowed down my requests by throwing a 2 sec time delay into the loop. It it taking a bit longer, but I am no longer getting the timeout errors and I'm currently doing 10,000 requests per batch.
from google_trans_new.
@bjquinniii Can you leave a sample of the code that incorporates the delay ? That would be extremely helpful
from google_trans_new.
it's just a matter of sticking a time.sleep(2) statement in...
so for mine it looks something like this:
from bs4 import BeautifulSoup as bs
from google_trans_new import google_translator
import mysql.connector as dbconnector
import time
I have a db table with html code I've scraped from a site, the relevant text is in a big block within another
dbConn = dbconnector.connect(host='localhost', port=3306, user=XXX, password=XXX, database='text', charset='utf8')
dbCur1 = dbConn.cursor()
dbCur2 = dbConn.cursor()
sql = 'select postID, divBlock from diaryPosts limit 10000;'
dbCur1.execute(sql)
singles = dbCur.fetchall()
dbCur1.close()
for s in singles:
postID = s[0]
divBlock = s[1]
soup = bs(divBlock, 'html.parser')
postTextObj = soup.find('div', {'class': 'texto-dou'})
postText = postTextObj.text.strip()
postTextTrans = translator.translate(postText, lang_tgt='en')
sql = 'update diaryPosts set postText = %s, postTextTrans = %s where postID = %s;'
dbCur2.execute(sql, (postText, postTextTrans, postID))
dbCur2.commit()
time.sleep(2)
anyways, that's probably more code than you were asking for, but I figure it will stave of other potential questions... the part you need is the time.sleep(2), I'm using it to slow down the loop that is making the calls.
from google_trans_new.
@bjquinniii Haha no problem. Thank you so much for your code response. I think this will help a lot of us.
from google_trans_new.
I have noticed something odd about using this library/service, it is a little flakey sometimes... it can run flawlessly for hours (current script just rolled by 6900 (out of 10000) without any errors. But sometimes I will come back and there will be some sort of odd random error. When that happens, I'll just restart it, and even though because of the way the query is written it ends up restarting at exactly the same entry that errored out, it will pick up, succeed, and roll on fine. I guess eventually I'll add a try block around the translate call, but so far it's happening infrequently enough that I haven't gotten around to it.
... just rolled by 7000
So far I have translated a bit over 43000 blocks of text on this particular project. I used the older version last fall to do about 180,000 on another project.
from google_trans_new.
Thanks,But when use vpn, i get the same error. so i try to use my phone to share wifi for the computer, it run.....
from google_trans_new.
same problem here ! did you find a solution guys !
from google_trans_new.
Same problem for me ( 429 (Too Many Requests) from TTS API. Probable cause: Unknown
).
from google_trans_new.
Same problem here.
from google_trans_new.
getting same error.
from google_trans_new.
Getting same error.
from google_trans_new.
Hello guys,
Did you find a solution to this ?
from google_trans_new.
when use the api,i get this error. ... google_trans_new.google_trans_new.google_new_transError: 429 (Too Many Requests) from TTS API. Probable cause: Unknown
I would just get a VPN. it will allow you to change domain when you have too many requests.
from google_trans_new.
Related Issues (20)
- How to deal with multiple returned translations? How to get 1st. translatin only? HOT 1
- PyPi release is outdated which causes JSON decode error on Google Colab HOT 7
- google trans new not working, causing jsonDecodeError HOT 13
- cannot import name '__title__' from 'requests.__version__ HOT 1
- this does not work at all, JSONDecodeError when parse the response HOT 3
- translate result is wrong comparing to the google translate website HOT 4
- error HOT 2
- python 3.9 object NoneType can't be used in 'await' expression
- src always 'en'
- 无法翻译 HOT 3
- the JSON object must be str, bytes or bytearray, not NoneType
- Bug on google_trans_new.py - google_translator.translate HOT 1
- sample code has error
- google_new_transError: 404 (Not Found) from TTS API. Probable cause: Unknown HOT 6
- requests.exceptions.ConnectTimeout HOT 1
- detect_lang not working HOT 7
- Issue #57 persists despite downloading updated codes HOT 1
- 404 Error HOT 4
- TypeError at random times
- 404 (Not Found) from TTS API. Probable cause: Unknown HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google_trans_new.