question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KeyError: 'image_url' in spookygif command

See original GitHub issue

Sentry Issue: SIR-LANCEBOT-83

KeyError: 'image_url'
  File "discord/ext/commands/core.py", line 167, in wrapped
    ret = await coro(*args, **kwargs)
  File "bot/exts/holidays/halloween/spookygif.py", line 28, in spookygif
    url = data["data"]["image_url"]

Unhandled command error: 'image_url'

This happens whenever running the .spookygif command, as image_url doesn’t exist in the reponse from the API. Changing the line to url = data["data"]["url"] might work instead. See the API docs here https://developers.giphy.com/docs/api/endpoint#random

posted by wookie184

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
wookie184commented, May 3, 2022

@SaumyaBhushan Thanks, I’ve assigned you. Note that the fix I mentioned in the issue may not be right. I think Discord may need a GIF, so looking at the docs we may need one of the other URLs in the response like data["data"]["images"]["downsized_large"]["url"] for it to work.

0reactions
Xithriuscommented, Sep 14, 2022

@JBarth86 it is done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

KeyError: 'image_url' Traceback (most recent call last) Error in ...
Python raises a KeyError whenever a dict() object is requested (using the format a = adict[key]) and the key is not in the...
Read more >
KeyError upon Instantiating an instance of the DEMProcessor ...
I am running PyDEM (0.2.0) on Python (2.7.14) and trying to follow the instructions on the readme.md file. Below I have listed the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found