googletrans python AttributeError: объект «NoneType» не имеет атрибута «группа»

Итак, я подготовил такой код:

async def cv_local(ctx, country=""):
    translator = Translator()
    try:
        country = translator.translate(country, dest='en').text
        now = datetime.datetime.now()
        # startTime = time.time()
        if country == "":
            country = "world"
            print("At " + str(now.hour) + ":" + str(now.minute) + " user " + str(ctx.message.author.name) + "(Id: " + str(
                ctx.message.author.id) + ")" +
                  " didn't mention any country, sent data for world")
        else:
            print("At " + str(now.hour) + ":" + str(now.minute) + " user " + str(ctx.message.author.name) + "(Id: " + str(
                ctx.message.author.id) + ")" + " searched for: " +
                  str(Library.exceptionCheck(country)[1]))

        if str(country).lower() == "world" or str(country).lower() == "kw" or str(country).lower() == "za":
            url = 'https://www.worldometers.info/coronavirus/'
            code = Library.HttpsRead(url, "świat", config[str(ctx.message.guild.id)]['lang'])
        else:
            temp1 = Library.exceptionCheck(country)[0]
            url = 'https://www.worldometers.info/coronavirus/country/' + temp1
            code = Library.HttpsRead(url, country, config[str(ctx.message.guild.id)]['lang'])

        message = await ctx.send(embed=code)
        await message.add_reaction("????")
        # print("execution took %s seconds \n" % (time.time() - startTime))
    except UnboundLocalError:
        await ctx.send("That's strange... It seems like you wanted data for country that doesn't exist in my database\nImportant message: if you would like to look for countries named with multiple words insert \"-\" instead of "
                       "spaces or use shortcuts f.e. \"uk\" instead of \"United Kingdom\" or \"south-africa\" instead of \"South Africa\"\n\n If error will be repeating report it to <@!287258679609393152>")
        print("Error occurred, user missed name of country")
        # print("execution took %s seconds \n" % (time.time() - startTime))
    except:
        await ctx.send("That's strange... Translator occurred some kind of error\nJust try again and everything should be just fine\n\n If error will be repeating report it to <@!287258679609393152>")
        print("Error occurred, informed user")
        # print("execution took %s seconds \n" % (time.time() - startTime))

Это дискорд бот, и раньше все работало отлично, но в последнее время он стал все чаще и чаще вылетать, вот лог ошибок:

Traceback (most recent call last):
  File "C:\Users\grzes\PycharmProjects\CoronaBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:/Users/grzes/PycharmProjects/CoronaBot/bot.py", line 222, in cv_local
    country = translator.translate(country, dest='en').text
  File "C:\Users\grzes\PycharmProjects\CoronaBot\venv\lib\site-packages\googletrans-2.3.0-py3.8.egg\googletrans\client.py", line 172, in translate
    data = self._translate(text, dest, src)
  File "C:\Users\grzes\PycharmProjects\CoronaBot\venv\lib\site-packages\googletrans-2.3.0-py3.8.egg\googletrans\client.py", line 75, in _translate
    token = self.token_acquirer.do(text)
  File "C:\Users\grzes\PycharmProjects\CoronaBot\venv\lib\site-packages\googletrans-2.3.0-py3.8.egg\googletrans\gtoken.py", line 186, in do
    self._update()
  File "C:\Users\grzes\PycharmProjects\CoronaBot\venv\lib\site-packages\googletrans-2.3.0-py3.8.egg\googletrans\gtoken.py", line 65, in _update
    code = unicode(self.RE_TKK.search(r.text).group(1)).replace('var ', '')
AttributeError: 'NoneType' object has no attribute 'group'

Я немного прочитал об этом и попробовал несколько решений из здесь, но у меня ничего не работает, может быть, это другая проблема, чем эта? Я просто понятия не имею, что еще делать, может ли кто-нибудь помочь с этим?

РЕДАКТИРОВАТЬ: добавлено os.environ["HTTPX_LOG_LEVEL"] = "DEBUG" И вывод выглядит следующим образом:

Traceback (most recent call last):
  File "C:\Users\grzes\PycharmProjects\CoronaBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:/Users/grzes/PycharmProjects/CoronaBot/bot.py", line 242, in cv_local
    code = Library.HttpsRead(url, country, config[str(ctx.message.guild.id)]['lang'])
  File "C:\Users\grzes\PycharmProjects\CoronaBot\Library.py", line 221, in HttpsRead
    embed = discord.Embed(title=translator.translate("Dane o chorobie", dest=currLang).text, description="[Support bot](https://kickstarter.com), [vote](https://top.gg), [support me](https://patreon.com)", color=0xf00000)
  File "C:\Users\grzes\PycharmProjects\CoronaBot\venv\lib\site-packages\googletrans-2.3.0-py3.8.egg\googletrans\client.py", line 172, in translate
    data = self._translate(text, dest, src)
  File "C:\Users\grzes\PycharmProjects\CoronaBot\venv\lib\site-packages\googletrans-2.3.0-py3.8.egg\googletrans\client.py", line 75, in _translate
    token = self.token_acquirer.do(text)
  File "C:\Users\grzes\PycharmProjects\CoronaBot\venv\lib\site-packages\googletrans-2.3.0-py3.8.egg\googletrans\gtoken.py", line 186, in do
    self._update()
  File "C:\Users\grzes\PycharmProjects\CoronaBot\venv\lib\site-packages\googletrans-2.3.0-py3.8.egg\googletrans\gtoken.py", line 65, in _update
    code = unicode(self.RE_TKK.search(r.text).group(1)).replace('var ', '')
AttributeError: 'NoneType' object has no attribute 'group'

person Moder New    schedule 04.11.2020    source источник
comment
Хм, в библиотеке нет обработки ошибок. :-\ Можете ли вы установить HTTPX_LOG_LEVEL=DEBUG в качестве переменной среды и посмотреть, не приведет ли какой-либо запрос к неожиданному результату?   -  person Klaus D.    schedule 04.11.2020
comment
Итак, как вы и просили, я добавил os.environ["HTTPX_LOG_LEVEL"] = "DEBUG" в код и ничего не изменилось.   -  person Moder New    schedule 04.11.2020
comment
Нет, задайте переменную в окружении (в терминале перед запуском программы).   -  person Klaus D.    schedule 04.11.2020
comment
Здравствуйте, я бы посоветовал вам попробовать документированную клиентскую библиотеку Google. Имейте в виду, что googletrans не поддерживается Google, и его результаты не гарантируются, как в примечании к библиотеке. Применение. См. эту запись.   -  person Sergi Muñoz    schedule 17.11.2020