I get status code 200 and can view the data via both url in browser or via print(response.text) but as soon as I try any of the entry level json lines in the script it fails:
Error without the try/except bit, I.e. just keeping print(response.json())
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I can't find a relatable solution to this anywhere other than suggestions the results aren't JSON?
Has anyone here messed around with dft data and found it behaves like this?
All the online docs suggest this is a really simple concept but as always I quickly run out of ideas when it comes to trying to learn in practice. Feels like it should be a 1 minute "oh yeah thats cool" early learning step surely?
Looking at learning about API query via Python.
Using live bus data from data.bus-dft.gov.uk that says it ouputs in json. https://data.bus-data.dft.gov.uk/guidance/requirements/?section=api
I get status code 200 and can view the data via both url in browser or via print(response.text) but as soon as I try any of the entry level json lines in the script it fails:
Script example:
Error without the try/except bit, I.e. just keeping print(response.json())
I can't find a relatable solution to this anywhere other than suggestions the results aren't JSON?
Has anyone here messed around with dft data and found it behaves like this?
All the online docs suggest this is a really simple concept but as always I quickly run out of ideas when it comes to trying to learn in practice. Feels like it should be a 1 minute "oh yeah thats cool" early learning step surely?