Skip to content

"Failed to decode json" using: examples/search_tracks.pyΒ #145

@mrto

Description

@mrto

Hi, I'm having trouble getting a response using examples/search_tracks.py. It seems the response from the server is empty.

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.9/site-packages/shazamio/utils.py", line 23, in validate_json
    return await resp.json(content_type=content_type)
  File "/home/pi/.local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1277, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 200, message='Attempt to decode JSON with unexpected mimetype: ', url='https://www.shazam.com/services/search/v3/en-US/GB/web/search?query=Lil&numResults=5&offset=0&types=songs'

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

Traceback (most recent call last):
  File "/home/pi/rec/shazamio-test.py", line 13, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/pi/rec/shazamio-test.py", line 8, in main
    tracks = await shazam.search_track(query="Lil", limit=5)
  File "/home/pi/.local/lib/python3.9/site-packages/shazamio/api.py", line 389, in search_track
    return await self.http_client.request(
  File "/home/pi/.local/lib/python3.9/site-packages/shazamio/client.py", line 54, in request
    raise e
  File "/home/pi/.local/lib/python3.9/site-packages/shazamio/client.py", line 52, in request
    return await validate_json(resp, *args)
  File "/home/pi/.local/lib/python3.9/site-packages/shazamio/utils.py", line 25, in validate_json
    raise FailedDecodeJson("Failed to decode json") from e
shazamio.exceptions.FailedDecodeJson: Failed to decode json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions