-
Notifications
You must be signed in to change notification settings - Fork 194
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
Yandex 403 #94
Comments
I'm thinking of using the implementation from this server in Yandex translator. I use it myself and it works great. |
I also have a question. Why not divide all translators into modules? As I understand it, they are loaded from one file, which looks a bit like a crutch. |
@bropines Sorry, bro. I saw it before, but forgot to reply after reading other questions. Thank you for the reference. Due to work reasons, the next update will be during the International Labor Day. |
It's a personal hobby. Since around 40 separate files makes the code very boring and garbage bin-like, I prefer to use classes and inheritance to build complex code and easily count how many lines of code the project has. |
You can take your time and spend the holidays with your loved ones.
Well, basically your job, do it the way it's convenient. I'm just used to projects where everything is divided into 1000 million modules. Nothing, and I figured it out in general. Thanks for the work. |
Respect and Thanks. |
@bropines Bro, please |
Yes, I saw it, thank you. I will check it Through my translator program and we can close the issue. |
@UlionTse
import translators as ts
# Просмотр доступных переводчиков
print(ts.translators_pool)
# Пример использования функции translate_text с Яндекс Переводчиком
translated_text = ts.translate_text(
query_text="もっと球を見る意識が大事だ! ! あとはできているの. . . ",
translator='yandex',
from_language='ja',
to_language='ru'
)
print(translated_text) log ╰─ python .\trasnasa.py
['alibaba', 'apertium', 'argos', 'baidu', 'bing', 'caiyun', 'cloudTranslation', 'deepl', 'elia', 'google', 'hujiang', 'iciba', 'iflytek', 'iflyrec', 'itranslate', 'judic', 'languageWire', 'lingvanex', 'niutrans', 'mglip', 'mirai', 'modernMt', 'myMemory', 'papago', 'qqFanyi', 'qqTranSmart', 'reverso', 'sogou', 'sysTran', 'tilde', 'translateCom', 'translateMe', 'utibet', 'volcEngine', 'yandex', 'yeekit', 'youdao']
Traceback (most recent call last):
File "D:\Рабочий стол\Рабочий стол Clear\trasnasa.py", line 7, in <module>
translated_text = ts.translate_text(
File "G:\Ballon-translator-portable-main\venv\lib\site-packages\translators\server.py", line 5555, in translate_text
return self.translators_dict[translator](query_text=query_text, from_language=from_language, to_language=to_language, **kwargs)
File "G:\Ballon-translator-portable-main\venv\lib\site-packages\translators\server.py", line 117, in _wrapper
return func(*args, **kwargs)
File "G:\Ballon-translator-portable-main\venv\lib\site-packages\translators\server.py", line 288, in _wrapper
return func(*args, **{**kwargs, **{'query_text': query_text}})
File "G:\Ballon-translator-portable-main\venv\lib\site-packages\translators\server.py", line 2387, in yandex_api
from_language, to_language = self.check_language(from_language, to_language, self.language_map, output_zh=self.output_zh)
File "G:\Ballon-translator-portable-main\venv\lib\site-packages\translators\server.py", line 194, in check_language
raise TranslatorError('Unsupported from_language[{}] in {}.'.format(from_language, sorted(language_map.keys())))
translators.server.TranslatorError: Unsupported from_language[ja] in ['az', 'be', 'bg', 'ca', 'cs', 'da', 'de', 'el', 'en', 'es', 'et', 'fi', 'fr', 'hr', 'hu', 'hy', 'it', 'lt', 'lv', 'mk', 'nl', 'no', 'pl', 'pt', 'ro', 'ru', 'sk', 'sl', 'sq', 'sr', 'sv', 'tr', 'uk'].
import translators as ts
# Просмотр доступных переводчиков
print(ts.translators_pool)
# Пример использования функции translate_text с Яндекс Переводчиком
translated_text = ts.translate_text(
query_text="もっと球を見る意識が大事だ! ! あとはできているの. . . ",
translator='yandex',
from_language='auto',
to_language='ru'
)
print(translated_text) log ╰─ python .\trasnasa.py
['alibaba', 'apertium', 'argos', 'baidu', 'bing', 'caiyun', 'cloudTranslation', 'deepl', 'elia', 'google', 'hujiang', 'iciba', 'iflytek', 'iflyrec', 'itranslate', 'judic', 'languageWire', 'lingvanex', 'niutrans', 'mglip', 'mirai', 'modernMt', 'myMemory', 'papago', 'qqFanyi', 'qqTranSmart', 'reverso', 'sogou', 'sysTran', 'tilde', 'translateCom', 'translateMe', 'utibet', 'volcEngine', 'yandex', 'yeekit', 'youdao']
важно осознавать, что нужно чаще видеть мяч! ! Остальное сделано. . . |
@bropines translators/translators/server.py Line 2341 in 13564ea
|
maybe you should add a message like "try auto" in response to a language that does not exist? |
@UlionTse Here is my JS code that roughly uses the same logic. |
Yandex translate doesn't work at all (google for example is fine)
Code:
import translators
print(translators.yandex("Привет"))
Output:
Using state Moscow server backend.
Traceback (most recent call last):
File "D:\Code\pythonProject\main.py", line 2, in
print(translators.yandex("Привет"))
File "D:\Code\pythonProject\venv\lib\site-packages\translators\apis.py", line 1418, in yandex_api
r.raise_for_status()
File "D:\Code\pythonProject\venv\lib\site-packages\requests\models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://translate.yandex.com/
The text was updated successfully, but these errors were encountered: