json.decoder.JSONDecodeError: Expecting value: line 1 column 102 (char 101)
jonata opened this issue · 0 comments
jonata commented
Hi. I am having this problem where I am not able to translate texts after some time. Maybe this is related to some api restriction?
File "/usr/local/lib/python3.8/dist-packages/pygoogletranslation/translate.py", line 73, in translate
data = self._translate(text, src=src, dest=dest)
File "/usr/local/lib/python3.8/dist-packages/pygoogletranslation/translate.py", line 186, in _translate
_format_data = utils.format_response(str(response.text))
File "/usr/local/lib/python3.8/dist-packages/pygoogletranslation/utils.py", line 64, in format_response
li_data = json.loads(fi_data.split('pygoogletranslation')[1].replace('"[', '[').replace(']"', ']'))
File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 102 (char 101)
If this is the case and is not fixable, maybe it could return some nicer message saying "you reached the daily limit" or something like that.
Thanks for considering!