Skip to main content

Library that interacts with TMB API

Project description

tmb - Python library for TMB API

build downloads version

Library to interact with the TMB (Transports Metropolitans de Barcelona) API.

Currently it supports the following TMB services:

  • iBus (get remain minutes for a given stop and line)
  • Planner (Get list of itineraries to go from from_coords to to_coords)

Generate API keys

  • Go to
  • Login using your personal account.
  • Create a new application, call it as you want.
  • Once created, you will see two variables: APP_ID and APP_KEY.



Create the iBus object using the API keys generated from TMB portal.

from tmb import IBus

ibus = IBus(APP_ID, APP_KEY)
forecast = ibus.get_stop_forecast('1265','V19')
print(f"{forecast} mins")


Create the Planner object using the API keys generated from TMB portal.

from tmb import Planner

planner = Planner(APP_ID, APP_KEY)
plans = planner.get_itineraries('41.3755204,2.1498870', '41.3878951,2.1308587')

Projects Depending on tmb

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tmb, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size tmb-0.1.1-py3-none-any.whl (4.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size tmb-0.1.1.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page