json.decoder.JSONDecodeError with Deezer API

Hey!

I’m using the Deezer API on one of my app’s pages, and while it worked well until recently, I’m now getting the following error message:

json.decoder.JSONDecodeError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).

Traceback:

File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 542, in _run_script
    exec(code, module.__dict__)File "/mount/src/streamlit/streamlit_app.py", line 758, in <module>
    player(search_bar)File "/mount/src/streamlit/streamlit_app.py", line 748, in player
    parsing = json.loads(request.text)File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None

Here’s the link to my app.
And here’s the link to my repo.

I tried updating Streamlit via my requirements.txt, but it didn’t solve anything so I ended up removing the versions to have a more generic requirements file… It didn’t change anything either.

Any ideas on where this issue might come from?

It looks like request.text is not valid JSON. I don’t think messing with your requirements is going to fix that.

The original error message may contain useful details, but you didn’t tell us…

Here is the original error message:


/mount/src/streamlit/streamlit_app.py:755: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

  OG_index = int(dfm2[dfm2['artist_track'] == OG].index.values)

2024-03-20 20:57:27.632 `label` got an empty value. This is discouraged for accessibility reasons and may be disallowed in the future by raising an exception. Please provide a non-empty label and hide it with label_visibility if needed.

2024-03-20 20:57:27.903 Uncaught app exception

Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 542, in _run_script

    exec(code, module.__dict__)

  File "/mount/src/streamlit/streamlit_app.py", line 758, in <module>

    player(search_bar)

  File "/mount/src/streamlit/streamlit_app.py", line 748, in player

    parsing = json.loads(request.text)

  File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads

    return _default_decoder.decode(s)

  File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode

    obj, end = self.raw_decode(s, idx=_w(s, 0).end())

  File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode

    raise JSONDecodeError("Expecting value", s, err.value) from None

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Well, nor really helpful by itself after all. Yet it makes it clear that request.text is not JSON.