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 · 8 comments
Open
2 tasks done

[Bug]: deepl is not stable #116

diwert-ai opened this issue Mar 3, 2023 · 8 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

@martinengelke
Copy link

possibility to enter my deepl API key somewhere?

@UlionTse
Copy link
Owner

@martinengelke
Unnecessary. This project accesses all public and free interfaces, and key-related access directly uses the official API interface. Of course, if you are talking about stability, the key will be more stable because it locks the user and the number of times, and there is no abuse prevention. The free interface is inevitably unstable because of similar anti-crawler reasons.

@martinengelke
Copy link

I thought I can get around potential captcha issues by entering my key.

@UlionTse
Copy link
Owner

@martinengelke
You're right. I hope everyone follows your example.

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

4 participants