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

[V3 Info] Don't rely on redirect #1581

Merged
merged 4 commits into from
May 2, 2018
Merged

[V3 Info] Don't rely on redirect #1581

merged 4 commits into from
May 2, 2018

Conversation

TheWyn
Copy link
Contributor

@TheWyn TheWyn commented May 1, 2018

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

Fixes following trace:

Exception in command 'info'
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/discord/ext/commands/core.py", line 62, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/redbot/core/core_commands.py", line 76, in info
    data = await r.json()
  File "/usr/lib/python3.6/site-packages/aiohttp/client_reqrep.py", line 730, in json
    headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8'

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

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/discord/ext/commands/bot.py", line 886, in invoke
    yield from ctx.command.invoke(ctx)
  File "/usr/lib/python3.6/site-packages/discord/ext/commands/core.py", line 514, in invoke
    yield from injected(*ctx.args, **ctx.kwargs)
  File "/usr/lib/python3.6/site-packages/discord/ext/commands/core.py", line 71, in wrapped
    raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientResponseError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8'

@TheWyn TheWyn requested a review from tekulvw as a code owner May 1, 2018 05:01
@Redjumpman
Copy link
Member

Just started experiencing this problem myself. The above changes fixes it for me.

@Bakersbakebread
Copy link
Contributor

Starting alfred... Connected to Discord. Getting ready... Loading packages... [01/05/2018 12:26] ERROR events on_error 174: Exception in on_ready Traceback (most recent call last): File "d:\alfred\venv\lib\site-packages\discord\client.py", line 224, in _run_event yield from coro(*args, **kwargs) File "d:\alfred\venv\lib\site-packages\redbot\core\events.py", line 114, in on_ready data = await r.json() File "d:\alfred\venv\lib\site-packages\aiohttp\client_reqrep.py", line 730, in json headers=self.headers) aiohttp.client_exceptions.ClientResponseError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8'

Getting the same error, above fixes for me.

@bobloy
Copy link
Contributor

bobloy commented May 1, 2018

Bread, your error is not the same error. Your error is in events.py, not core_commands.py

Copy link
Contributor

@bobloy bobloy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

core/events.py has the same problem and should be updated as well.

@@ -72,7 +72,7 @@ def __init__(self, bot):
owner = app_info.owner

async with aiohttp.ClientSession() as session:
async with session.get("http://pypi.python.org/pypi/red-discordbot/json") as r:
async with session.get("https://pypi.python.org/pypi/red-discordbot/json") as r:
Copy link
Contributor

@bobloy bobloy May 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace this with session.get('{}/json'.format(red_pypi)) defined above

wyn10 added 2 commits May 1, 2018 17:43
Use existing variable instead of new string
Remove redirect, url only reference
@Kowlin Kowlin merged commit 9188e4a into Cog-Creators:V3/develop May 2, 2018
@TheWyn TheWyn deleted the patch-3 branch May 3, 2018 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants