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

[GoogleTrends] Cog not working #119

Open
mrPauwHaan opened this issue Jun 22, 2023 · 1 comment
Open

[GoogleTrends] Cog not working #119

mrPauwHaan opened this issue Jun 22, 2023 · 1 comment
Labels
cog: googletrends type: bug Something isn't working

Comments

@mrPauwHaan
Copy link
Contributor

What cog is this bug report for?

GoogleTrends

What versions are you running?

No response

Describe the bug

When I use a command I am getting the error as shown below

If there's an error, paste it here

Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 229, in wrapped
    ret = await coro(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/cogs/CogManager/cogs/googletrends/googletrends.py", line 113, in trends
    request = await self.get_trends_request(list(query), timeframe, geo)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/cogs/CogManager/cogs/googletrends/plot.py", line 42, in get_trends_request
    return await self.bot.loop.run_in_executor(self.executor, func)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/cogs/CogManager/cogs/googletrends/plot.py", line 47, in _get_trends_request
    trend.build_payload(
  File "/data/cogs/Downloader/lib/pytrends/request.py", line 189, in build_payload
    self._tokens()
  File "/data/cogs/Downloader/lib/pytrends/request.py", line 195, in _tokens
    widget_dicts = self._get_data(
                   ^^^^^^^^^^^^^^^
  File "/data/cogs/Downloader/lib/pytrends/request.py", line 124, in _get_data
    retry = Retry(total=self.retries, read=self.retries,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Retry.__init__() got an unexpected keyword argument 'method_whitelist'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
    await ctx.command.invoke(ctx)
  File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1023, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 238, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Retry.__init__() got an unexpected keyword argument 'method_whitelist'
@mrPauwHaan mrPauwHaan added the type: bug Something isn't working label Jun 22, 2023
@Vexed01
Copy link
Owner

Vexed01 commented Jul 13, 2023

This appears to be an issue with version 2 and above of urllib3, I'm waiting for the maintainer of pytrends to update to support the new urllib.

As Red is a large project, it wouldn't be a good idea to make the whole bot and every other installed cog use an outdated version of urllib3 just so this cog can work - in fact it might break other cogs or core Red. It's just a waiting game at the moment, through if it takes a while I might look into making my own fork of the pytrends library and fixing it there.

I've added a more friendly error in 79e609c

Progress can be seen in GeneralMills/pytrends#591

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cog: googletrends type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants