Skip to main content

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

Project description

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, this package only supports the Lift Disruptions API and Accident Stats API. However, 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.LiftDisruptionsV2Client() as client:
    response = await client.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

Project details


Download files

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

Source Distribution

py_tfl-0.2.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

py_tfl-0.2.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file py_tfl-0.2.0.tar.gz.

File metadata

  • Download URL: py_tfl-0.2.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for py_tfl-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c7384e337b18a7c8bc20b45da15658a0d0f62c89949c8c27e09018d8eaf6149a
MD5 a55f0e7e07d60035b06ee16e448b90f1
BLAKE2b-256 582790525d8be7088301e3b257677e0860c7bb0c7cfbd41439d585654233627d

See more details on using hashes here.

File details

Details for the file py_tfl-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: py_tfl-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for py_tfl-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3aae9a9602455c174a3e13c0ad0b4171ef70f9867a63868ed4b585a132459f61
MD5 69008e27b1b0b253d0a2f826a9ce092d
BLAKE2b-256 3f00170c35a61fb5eee8a264e195124879bc73c6f0c676feadc5d91d914035ce

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page