Python Forum

Full Version: JSONDecodeError: Expecting value
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I'm trying to read json content from a url, however, it is displaying the below error in spite of status 200 (<Response [200]>).

JSONDecodeError: Expecting value

Below is the code:

jUrl_dummy = 'https://abc.dummy.com/rest/api/latest/search?fields=%s&query=%s'
fields_dummy = 'key,summary'
username = credentials.login['username']
password = credentials.login['password']
query_dummy = ('project = xxx')
r_dummy = requests.get(jUrl_dummy % (fields_dummy, query_dummy), auth = (username, password))
print(r_dummy)
j_dummy = r_dummy.json() --> This gives the error
Can someone please help with the resolution?
Just because the server thinks that the query and the server's response was correct (200), doesn't mean that the response is json or that the server's response was bug-free.

Have you examined r_dummy.text or r_dummy.contentto see what the content looks like? (Although in this case it appears to be sending no data).

Could it be sending a cookie instead (which is then to be used for later requests)?