eshapard / AnkiHabitica

Anki 2.0/2.1 add-on for use with HabitRPG. Automatically scores habits when you reach the end of your Anki timebox and when you review all cards in a deck.
GNU General Public License v3.0
197 stars 31 forks source link

Error #123

Closed Sofilopi08 closed 2 years ago

Sofilopi08 commented 3 years ago

Error Se ha producido un error. Por favor inicia la Anki manteniendo presionadas ples teclas Mayús y la flecha hacia abajo, lo que desactivará temporalmente los extensiones que tienes instaladas. Si este error persiste sólo cuando tienes las extensiones activadas, utiliza Herramientas > Menú de Extensiones para deshabilitar alguna extensión y reinicia el Anki, repitiendo este proceso hasta que descubras qué extensión en concreto es la que causa el problema Cuando hayas descubierto la extensión que causaba el problema, por favor informa de esto a sitio de soporte de extensiones. Información de depuración: Anki 2.1.44 (b2b3275f) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2 Platform: Mac 10.16 Flags: frz=True ao=True sv=2 Add-ons, last update check: 2021-07-18 08:09:29 Complementos posiblemente implicados: ⁨Anki Habitica for 21⁩

Caught exception: Traceback (most recent call last): File "aqt/progress.py", line 53, in handler File "aqt/main.py", line 142, in on_window_init File "aqt/main.py", line 231, in setupProfile File "aqt/main.py", line 413, in loadProfile File "aqt/hooks_gen.py", line 2194, in call File "anki/hooks.py", line 34, in runHook File "/Users/sofiabarreiro/Library/Application Support/Anki2/addons21/1758045507/init.py", line 751, in grab_profile check_unsynced_score() File "/Users/sofiabarreiro/Library/Application Support/Anki2/addons21/1758045507/init.py", line 707, in check_unsynced_score if not (be_ready() and ah.user_settings["check_db_on_profile_load"] and ah.habitica.grab_scorecounter() and compare_score_to_db()): File "/Users/sofiabarreiro/Library/Application Support/Anki2/addons21/1758045507/habitica_class.py", line 369, in grab_scorecounter response = self.api.task(self.habit_id) File "/Users/sofiabarreiro/Library/Application Support/Anki2/addons21/1758045507/habitica_api.py", line 106, in task out = self.v3_request("get", "/tasks/%s" % str(task_id)) File "/Users/sofiabarreiro/Library/Application Support/Anki2/addons21/1758045507/habitica_api.py", line 75, in v3_request response = json.load(opener.open(req, timeout=timeout)) File "urllib/request.py", line 531, in open File "urllib/request.py", line 640, in http_response File "urllib/request.py", line 569, in error File "urllib/request.py", line 502, in _call_chain File "urllib/request.py", line 649, in http_error_default urllib.error.HTTPError: HTTP Error 429: Too Many Requests

Rene2704 commented 2 years ago

Hello,

the error often occurs when an API identifies to many requests from a specific API or when no User-Agent is provided. The workaround for us with AnkiHabitica would be to add a new line of code in the function v3_request(...) of the file habitica_api.py that specifies the header. E.g. in line 50: req.add_header('User-Agent', 'My Bot 0.1')

71e6fd52 commented 2 years ago

fixed 067cd9d