jamieqianhui / URA_API_GETrequest

Retrieve latest month's data on median rentals of private non-landed residential properties in Singapore (data published by URA)
0 stars 2 forks source link

Keep getting JSONDecodeError #1

Open kiwibirdegg opened 3 years ago

kiwibirdegg commented 3 years ago

I tried breaking your code down into two parts, one for token generation and the other one for data retrieval to rectify the issue.

Seems like the error is originated from "return json.loads(response.content.decode('utf-8'))" , but I could be wrong. Just starting to learn API here.

Thanks.

kiwibirdegg commented 3 years ago

Upon further research, I found that the Content-Type is originally in "text/html". I believe that's the reason why you added the decode statement there, and by right it should not yield "JSONDecodeError: Expecting value: line 1 column 1 (char 0)"