jamesnicolas / yomichan-forvo-server

An audio server for yomichan that scrapes forvo for audio files
33 stars 16 forks source link

Yomichan forvo server error #2

Closed mavicena21 closed 2 years ago

mavicena21 commented 3 years ago

image Everytime i use yomichan with yomichan forvo server i keep get warning like that from anki even though yomichan can play audio from forvo, i always get that warning without stop.

    An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.35 (84dcaa86) Python 3.8.0 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2021-08-12 13:53:17

WARNING:urllib3.connectionpool:Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='forvo.com', port=443): Read timed out. (read timeout=1)")': /search/%E3%81%82%E3%82%84/ja/
roboticsbrian commented 3 years ago

I get a similar exception. Here's the full stack trace from the Anki dialog:

Exception happened during processing of request from ('127.0.0.1', 39250)
Traceback (most recent call last):
  File "urllib3/connectionpool.py", line 421, in _make_request
  File "<string>", line 3, in raise_from
  File "urllib3/connectionpool.py", line 416, in _make_request
  File "http/client.py", line 1322, in getresponse
  File "http/client.py", line 303, in begin
  File "http/client.py", line 264, in _read_status
  File "socket.py", line 669, in readinto
  File "ssl.py", line 1241, in recv_into
  File "ssl.py", line 1099, in read
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "urllib3/connectionpool.py", line 665, in urlopen
  File "urllib3/connectionpool.py", line 423, in _make_request
  File "urllib3/connectionpool.py", line 330, in _raise_timeout
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='forvo.com', port=443): Read timed out. (read timeout=1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "requests/adapters.py", line 439, in send
  File "urllib3/connectionpool.py", line 747, in urlopen
  File "urllib3/connectionpool.py", line 747, in urlopen
  File "urllib3/connectionpool.py", line 747, in urlopen
  File "urllib3/connectionpool.py", line 719, in urlopen
  File "urllib3/util/retry.py", line 436, in increment
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='forvo.com', port=443): Max retries exceeded with url: /word/%E6%9D%90/ (Caused by ReadTimeoutError("HTTPSConnectionPool(host='forvo.com', port=443): Read timed out. (read timeout=1)"))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "socketserver.py", line 650, in process_request_thread
  File "socketserver.py", line 360, in finish_request
  File "http/server.py", line 646, in __init__
  File "socketserver.py", line 720, in __init__
  File "http/server.py", line 426, in handle
  File "http/server.py", line 414, in handle_one_request
  File "/home/brian/.local/share/Anki2/addons21/580654285/__init__.py", line 178, in do_GET
    audio_sources = self.forvo.word(expression)
  File "/home/brian/.local/share/Anki2/addons21/580654285/__init__.py", line 71, in word
    html = self._get(path)
  File "/home/brian/.local/share/Anki2/addons21/580654285/__init__.py", line 61, in _get
    return self.session.get(url, timeout=1).text
  File "requests/sessions.py", line 546, in get
  File "requests/sessions.py", line 533, in request
  File "requests/sessions.py", line 646, in send
  File "requests/adapters.py", line 516, in send
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='forvo.com', port=443): Max retries exceeded with url: /word/%E6%9D%90/ (Caused by ReadTimeoutError("HTTPSConnectionPool(host='forvo.com', port=443): Read timed out. (read timeout=1)"))
----------------------------------------
kit-nya commented 2 years ago

Hi, the issue here seems to be that the timeout was set to 1 second and if forvo didn't respond within 1 second at all, then it retried till it failed. I've created a pull request to fix these changes, otherwise you can simply use the version in my fork. (https://github.com/Rawrskyes/yomichan-forvo-server) Will be fixed by pull request #4

jamesnicolas commented 2 years ago

I just deployed the merge from #4, do you still have timeout issues?

jamesnicolas commented 2 years ago

Going to close this since it's really old and I haven't heard of any more timeout issues