Python - Attempt to decode JSON with unexpected mimetype:

Pass expected content type to json() method:

data = await resp.json(content_type='text/html')

or disable the check entirely:

data = await resp.json(content_type=None)

aiohttp is trying to do the right thing and warn you of incorrect Content-Type, which could at worst indicate that you are not getting JSON data at all, but something unrelated, such as the HTML content of an error page.

However, in practice many servers are misconfigured to always send the incorrect MIME type in their JSON responses, and JavaScript libraries apparently don't care. If you know you're dealing with such a server, you can always silence the warning by invoking json.loads yourself:

import json
# ...

async with self._session.get(uri, ...) as resp:
    data = await resp.read()
hashrate = json.loads(data)

Specifying Content-Type as you attempted makes no difference because it only affects the Content-Type of your request, whereas the problem lies in the Content-Type of the server's response, which is not under your control.