2

I'm using Translator from the python library googletrans. I used it well for over 2 months now but somehow, today I received the "httpcore._exceptions.ReadTimeout: The read operation timed out for googletrans library":

File "/Users/suzuki/Desktop/Project/X/rX.py", line 60, in get_mercari_products
    english_product_name = str(translator.translate(product_name).text)
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/googletrans/client.py", line 194, in translate
    data, response = self._translate(text, dest, src)
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/googletrans/client.py", line 120, in _translate
    r = self.client.post(url, params=params, data=data)
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpx/_client.py", line 824, in post
    return self.request(
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpx/_client.py", line 600, in request
    return self.send(
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpx/_client.py", line 620, in send
    response = self.send_handling_redirects(
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpx/_client.py", line 647, in send_handling_redirects
    response = self.send_handling_auth(
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpx/_client.py", line 684, in send_handling_auth
    response = self.send_single_request(request, timeout)
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpx/_client.py", line 714, in send_single_request
    ) = transport.request(
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpcore/_sync/connection_pool.py", line 152, in request
    response = connection.request(
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpcore/_sync/connection.py", line 78, in request
    return self.connection.request(method, url, headers, stream, timeout)
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpcore/_sync/http2.py", line 118, in request
    return h2_stream.request(method, url, headers, stream, timeout)
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpcore/_sync/http2.py", line 292, in request
    status_code, headers = self.receive_response(timeout)
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpcore/_sync/http2.py", line 344, in receive_response
    event = self.connection.wait_for_event(self.stream_id, timeout)
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpcore/_sync/http2.py", line 197, in wait_for_event
    self.receive_events(timeout)
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpcore/_sync/http2.py", line 204, in receive_events
    data = self.socket.read(self.READ_NUM_BYTES, timeout)
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpcore/_backends/sync.py", line 62, in read
    return self.sock.recv(n)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/Users/suzuki/Desktop/Testing/venv/lib/python3.8/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
    raise to_exc(exc) from None
httpcore._exceptions.ReadTimeout: The read operation timed out

Can someone pls help me explain what the error aboves mean and potentially how I can solve it? Is it because googletrans become broken temporarily as the library notes that "it is at times unstable"?

Thank you!!

Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
SuzukuMiyota
  • 29
  • 1
  • 2
  • 2
    likely dupe of [this question](https://stackoverflow.com/q/65279841/9267296). As per [this answer](https://stackoverflow.com/a/65283885/9267296) you are likely being blocked by Google due to request spamming. You should switch to using the official Google Translate API library, see [this doc](https://cloud.google.com/translate/docs/reference/libraries/v2/python) – Edo Akse May 25 '22 at 10:21
  • Does this answer your question? [Googletrans throws a ConnectTimeout error (the handshake operation timed out)](https://stackoverflow.com/questions/65279841/googletrans-throws-a-connecttimeout-error-the-handshake-operation-timed-out) – Ilya Jul 28 '23 at 19:39

0 Answers0