Skip to main content

TFL-Image.jpg

Python Code style: black Checked with mypy Ruff Pre-commit Semantic Versions Code Stability Unit Tests codecov CodeFactor

A Python package for the Transport for London (TFL) API.

The TFL API is a RESTful API that provides data related to all modes of transport in London, including cycle hire, buses, roads, and the underground. Anonymous access to the TFL API is limited to 50 requests a minute. If you want to call the API more than that, you'll need to subscribe to a "Product" which lets you bypass this limit with a subscription-key that you append to your requests.

Currently, we support the following APIs:

The plan is to add support for all the TFL APIs. Contributions are welcome!

🫶 Installation

pip install py-tfl

or install with Poetry:

poetry add py-tfl

⚡️Quickstart

⌨️ CLI

The TFL CLI provides a command line interface to the TFL API. It is built on top of Typer, which provides easy way to build command line interfaces.

tfl --help

🦋 Client

The TFL client provides a Python interface to the TFL API. It provides a Pythonic interface to the API, and handles authentication and rate limiting for you. The client is built on top of HTTPX, which provides a fast, async HTTP client.

from tfl import clients


async with clients.TFLClient(auth=clients.Auth(key="<your-tfl-api-key>")) as client:
    response = await client.handlers.lift_disruptions_v2_handler.get_lift_disruptions()

print(response.json())

📈 Releases

You can see the list of available releases on the GitHub Releases page.

We follow Semantic Versions specification.

We use Release Drafter. As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when you’re ready. With the categories option, you can categorize pull requests in release notes using labels.

🛡 License

License

This project is licensed under the terms of the MIT license. See LICENSE for more details.

🚀 Credits

A special thanks to HTTPX, Typer, and the TFL API team for making this project possible.

This project was built using IntelliJ IDEA.

JetBrains Black Box Logo logo

Metadata

Release files for py-tfl 0.5.0

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

Source distribution (sdist)

Source distribution for py-tfl 0.5.0
File Size Uploaded Provenance Actions
py_tfl-0.5.0.tar.gz 11.4 kB Without provenance Details for py_tfl-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-tfl 0.5.0
File Interpreter ABI Platform Actions
py_tfl-0.5.0-py3-none-any.whl Python 3 none any Details for py_tfl-0.5.0-py3-none-any.whl

Total release size: 26.4 kB

Release files / py_tfl-0.5.0.tar.gz

Download URL py_tfl-0.5.0.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2685e565db3c1cb87d8c7efa00ea58941197d7b9f9651efb21b258c94471dce5
BLAKE2b-256 checksum
How to use checksums
c1c03b86f5870de337fc91958582b1969da445ccb3aef365293039d168942051
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.1 CPython/3.11.4

Release files / py_tfl-0.5.0-py3-none-any.whl

Download URL py_tfl-0.5.0-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3952f6c42107948ddf07d2ec5bd7700f203228acaa1c25fbb7d35516c044b339
BLAKE2b-256 checksum
How to use checksums
6d0835f0015f7ff1caf97070691ad127e442fe18637210e59769aba51175aae3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.1 CPython/3.11.4

Security for py-tfl 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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