Skip to main content

citram-python-api

Python wrapper of Consorcio de Transportes de Madrid (CTRM) API.

This module seeks to comprise all the CTRM endpoints, using different CTRM APIs.

With this API you can request static and live (not as a streaming) for the different public transport the CTRM manages: Madrid Metro, MetroSur Metro, Cercanías Renfe, Madrid EMT buses, intercity buses, multi-transport stations (intercambiadores), and Metro Ligero. You can request information of CTRM offices and parkings.

Any kind of transport fits in the paradigm of stops and lines.

Please visit https://citram-python-api.readthedocs.io/en/latest/ to read the documentation.

Modules description:

  • lines: Requests relative to transport lines.
  • offices: Requests relative to CTRM offices.
  • stops: Requests relative to transport stops.
  • others: Other relevant requests that don't fit in any of the other categories.
  • constants: Useful constants to use when making requests.
  • utils: Useful functions to use when making requests.

Some tips:

  • When writing line names, they're usually in upper case and have no whitespaces nor other characters like dashes or underscores. The functions in utils.utils can help you to create stop and line codes.

  • With the constants module you can make requests about municipalities, transport modes and office types easily.

  • In case your mother tongue is English and you're having trouble understanding the different transports, you might find this link helpful: https://www.crtm.es/widgets/language.json

  • Sometimes you'll see kmz links. kmz files are used by Google Maps or Google Earth to display a set of points or geometric figures in a map.

  • When the field access is greater than 0, it means the stop is adapted to people with special conditions.

  • When the field park is greater than 0, it means that stop has a parking.

  • When the field nightService or nightLinesService is greater than 0, it means that line has night service (sometimes this is called Búho, specially on bus lines).

Example of use

from citram_api.constants.constants import TransportModes
from citram_api.api.lines.lines import get_line_info
from citram_api.utils.utils import create_line_cod

line_info = get_line_info(create_line_cod(TransportModes.METRO.value, 10))

Release files for citram-python-api 1.0.3

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

Source distribution (sdist)

Source distribution for citram-python-api 1.0.3
File Size Uploaded
citram-python-api-1.0.3.tar.gz 12.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for citram-python-api 1.0.3
File Interpreter ABI Platform
citram_python_api-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 29.3 kB

Release files / citram-python-api-1.0.3.tar.gz

Download URL citram-python-api-1.0.3.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f28128223928352dcd9c8b9da77d5f67bf71390d3ba8ad7d3f4825f7a866f9b0
BLAKE2b-256 checksum
How to use checksums
fc8333f680cf68d217b2865cda428a0cf7398d4215d4a74915b7ae852f9417da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.6

Release files / citram_python_api-1.0.3-py3-none-any.whl

Download URL citram_python_api-1.0.3-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1f0c06a0e85f4823c2c563b50650e8e2d2bd34c34f531e1175c628ee45f4014
BLAKE2b-256 checksum
How to use checksums
321c972a4f687623e5550c79e07f74e1c63a5ce3e0329956b021847b4bafad09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.6

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

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