The NextBus agency list

NextBus customers are called agencies. In our examples, we will track buses on a route for Los Angeles, California. First, we need to get some information about the agency. The NextBus API consists of a web service named publicXMLFeed in which you set a parameter named command. We'll call the agencyList command in a browser to get an XML document containing the agency information using the following REST URL: http://webservices.nextbus.com/service/publicXMLFeed?command=agencyList.

When we go to this link in a browser, it returns an XML document containing the <agency/> tag. The tag for Los Angeles looks as follows:

<agency tag="lametro" title="Los Angeles Metro" regionTitle="California-Southern"/>

Get Learning Geospatial Analysis with Python - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.