Skip to main content

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 developer.tmb.cat.
  • 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.

Example

iBus

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")

Planner

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')
print(plans)

Projects Depending on tmb

https://github.com/home-assistant/home-assistant

Release files for tmb 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tmb 0.1.5
File Size Uploaded
tmb-0.1.5.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tmb 0.1.5
File Interpreter ABI Platform
tmb-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / tmb-0.1.5.tar.gz

Download URL tmb-0.1.5.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
41d28eb9679882f9a56aa11a117781d06419c4a5da7d9c75da75da5c2d7d2019
BLAKE2b-256 checksum
How to use checksums
fde278f0b732c4dcac886a4d4b8dfcf629fa99e7b5a27bf39fa397dd710c2bf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release files / tmb-0.1.5-py3-none-any.whl

Download URL tmb-0.1.5-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f658fe75934e40890d37b591bf6d4f370b727f591622e69eaa7826a11a6a529
BLAKE2b-256 checksum
How to use checksums
8cdc8c9bdef5f7356d89c765e0127cb80c61ae7feb586bf25a8ba58c6c153bfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page