EMT Madrid, (the organization that operates the buses in Madrid), offers a public API with information such as waiting times, stop locations, etc.
I used this API some time ago to develop the madtrans Zoe agent: I performed the requests manually and parsed the data accordingly, although I only implemented some of the endpoints offered by the API. After a while I thought about creating a wrapper for the API in order to use it to improve the agent.
With the documentation available, I started developing the wrapper. I am not ashamed to admit that this development lasted less than a week: I got somewhat frustrated with some particular things of the API and put the project aside. Some weeks ago, however, I decided to continue developing the wrapper because of another project of which I will not talk about just yet.
The result is the
pyemtmad wrapper for Python! It is definitely not perfect, but at least simplifies things greatly for me and kind of works. In order to use it, you just need credentials to access the API and instantiate a
Wrapper as follows:
from pyemtmad import Wrapper wrapper = Wrapper('MY_ID', 'MY_PASSWORD')
All the endpoints are then available through attributes of the
wrapper object. Parameters and further details are available in the documentation.
Hope it is useful for someone!