Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: deepl is not stable #116

Open
2 tasks done
diwert-ai opened this issue Mar 3, 2023 · 4 comments
Open
2 tasks done

[Bug]: deepl is not stable #116

diwert-ai opened this issue Mar 3, 2023 · 4 comments

Comments

@diwert-ai
Copy link

Debug Tips

  • I'm sure I've read this project's Issues of README.

What happened?

Deepl is not stable. Sometimes it works fine, sometimes it gives an error (see below)

APP Version

5.5.6

Python Version

=3.6, <=3.8

Runtime Environment

Linux Ubuntu

Country/Region

US

Relevant log output

import translators as ts
print(ts.translate_text(query_text='To be, or not to be, that is the question!', to_language='ru',  translator='deepl'))

output:

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
<ipython-input-6-428c3aab60d7> in <module>
      1 import translators as ts
      2 #import translators.server as tss
----> 3 print(ts.translate_text(query_text='To be, or not to be, that is the question!', to_language='ru',  translator='deepl'))

4 frames
/usr/local/lib/python3.8/dist-packages/translators/server.py in translate_text(self, query_text, translator, from_language, to_language, **kwargs)
   3113         if translator not in self.translators_pool:
   3114             raise TranslatorError
-> 3115         return self.translators_dict[translator](query_text=query_text, from_language=from_language, to_language=to_language, **kwargs)
   3116 
   3117     def translate_html(self,

/usr/local/lib/python3.8/dist-packages/translators/server.py in _wrapper(*args, **kwargs)
     96                 sys.stderr.write(f'CostTime(function: {func.__name__[:-4]}): {cost_time}s\n')
     97                 return result
---> 98             return func(*args, **kwargs)
     99         return _wrapper
    100 

/usr/local/lib/python3.8/dist-packages/translators/server.py in _wrapper(*args, **kwargs)
    223                 new_args[1] = query_text
    224                 return func(*tuple(new_args), **kwargs)
--> 225             return func(*args, **{**kwargs, **{'query_text': query_text}})
    226         return _wrapper
    227 

/usr/local/lib/python3.8/dist-packages/translators/server.py in deepl_api(self, query_text, from_language, to_language, **kwargs)
   1768 
   1769         r_cs = self.session.post(self.api_url, params=self.params['handle'], json=h_data, headers=self.api_headers, timeout=timeout, proxies=proxies)
-> 1770         r_cs.raise_for_status()
   1771         data = r_cs.json()
   1772         time.sleep(sleep_seconds)

/usr/local/lib/python3.8/dist-packages/requests/models.py in raise_for_status(self)
   1019 
   1020         if http_error_msg:
-> 1021             raise HTTPError(http_error_msg, response=self)
   1022 
   1023     def close(self):

HTTPError: 429 Client Error:  for url: https://www2.deepl.com/jsonrpc?method=LMT_handle_jobs


### Screenshots

```Markdown
![DESCRIPTION](LINK.png)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@UlionTse
Copy link
Owner

UlionTse commented Mar 6, 2023

@diwert-ai Yeah. At some point deepl will trigger a captcha, and api requests without captcha validation will be forbidden.

@reddere
Copy link

reddere commented Sep 7, 2023

Is there any fix to this?

@UlionTse
Copy link
Owner

@reddere Not yet

@UlionTse
Copy link
Owner

@reddere Bro, please try pip install --upgrade translators==5.8.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants