UlionTse / translators

🌏🌍🌎Translators🌎🌍🌏 is a library that aims to bring free, multiple, enjoyable translations to individuals and students in Python. Translators是一个旨在用Python为个人和学生带来免费、多样、愉快翻译的库。
https://pypi.org/project/translators/
GNU General Public License v3.0
1.62k stars 189 forks source link

[Bug]: AttributeError: 'NoneType' object has no attribute 'group' in languageWire translator #127

Closed ali1hammoud closed 1 year ago

ali1hammoud commented 1 year ago

Debug Tips

What happened?

I wrote this code: ts.translate_text('hello, how are you?', translator='languageWire', from_language='en', to_language='ar')

APP Version

5.7.1

Python Version

3.10

Runtime Environment

Other

Country/Region

Russia

Relevant log output

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-19-0524fc051e29> in <cell line: 1>()
----> 1 ts.translate_text('hello, how are you?', translator='languageWire', from_language='en', to_language='ar')

4 frames
/usr/local/lib/python3.10/dist-packages/translators/server.py in get_lwt_data(self, lwt_js_url, ss, headers, timeout, proxies)
   4374         js_html = ss.get(lwt_js_url, headers=headers, timeout=timeout, proxies=proxies).text
   4375         lwt_data = {
-> 4376             'x-lwt-application-id': re.compile('"X-LWT-Application-ID":"(.*?)"').search(js_html).group(1),
   4377             'x-lwt-build-id': re.compile('"X-LWT-Build-ID":"(.*?)"').search(js_html).group(1),
   4378         }

AttributeError: 'NoneType' object has no attribute 'group'

Code of Conduct

UlionTse commented 1 year ago

Hello fiend, What is your Runtime Environment(Other)? This is a bug, please upgrade v5.7.2