An error regarding a response code of 300

When I try to run my code between some stations like Canada Water and Penge West

I receive a ‘KeyError: ‘location’’ Whats the issue?

here’s my code:


don’t worry about all the excessive comments its necessary for my coursework project

It works for some stations and then just doesnt work for others. I tried to find the travel time between Oxford Circus and Waterloo yesterday and it worked just fine, then I tried to do it again today and it just doesnt work. I understand briefly that the issue is that there is no location for my if statement to proceed with but surely there should be? Why wouldnt the API give me another url to proceed with?

Anyone got something to say about this? I’d appreciate it, this has been bugging me.

hi @Ja123

The 300 (multiple choices) response is returned when there is a possibility of multiple station matches.

This then allows you to specify a URI that will provide a disambiguated journey.

For instance, Euston will provide you multiple options (Euston, Euston Square etc) to choose from.

If you can specify the stops’ ICS code or NaPTAN code in the request, this should stop the need for disambiguation.


That makes more sense, will try it out soon! Thank you.

1 Like