Library that interacts with TMB API
Project description
tmb - Python library for TMB API
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
toto_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
andAPP_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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tmb-0.1.5.tar.gz
(4.5 kB
view details)
Built Distribution
tmb-0.1.5-py3-none-any.whl
(4.6 kB
view details)
File details
Details for the file tmb-0.1.5.tar.gz
.
File metadata
- Download URL: tmb-0.1.5.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41d28eb9679882f9a56aa11a117781d06419c4a5da7d9c75da75da5c2d7d2019 |
|
MD5 | b97aa7617ecdbe83e0623d33a821e2f1 |
|
BLAKE2b-256 | fde278f0b732c4dcac886a4d4b8dfcf629fa99e7b5a27bf39fa397dd710c2bf0 |
File details
Details for the file tmb-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: tmb-0.1.5-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f658fe75934e40890d37b591bf6d4f370b727f591622e69eaa7826a11a6a529 |
|
MD5 | 92c0b659f1497f429961ea9b5f15b381 |
|
BLAKE2b-256 | 8cdc8c9bdef5f7356d89c765e0127cb80c61ae7feb586bf25a8ba58c6c153bfe |