Skip to content

Bitcoin price fails with unexpected mimetype "application/json" #97

Closed
@AllanTaylor314

Description

@AllanTaylor314

Describe the bug
The bitcoin command fails to parse the response since Coindesk have fixed their API.
discord.app_commands.errors.CommandInvokeError: Command 'bitcoin' raised an exception: ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: application/json; charset=utf-8', url=URL('https://api.coindesk.com/v1/bpi/currentprice/BTC.json')

To Reproduce
Run /bitcoin

Expected behavior
An embed with the current price of bitcoin is displayed

Template Version
6.1.0

Additional context
Coindesk seems to have fixed their API to return the correct MIME type. Previously it returned application/javascript as noted in the code. I would propose removing the explicit content_type (default application/json) or setting it to None to explicitly ignore MIME type.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority: mediumThis has a medium priority

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions