KeyError: 'image_url' in spookygif command
See original GitHub issueSentry 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:
- Created a year ago
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.@JBarth86 it is done.