Skip to main content

python client for HAFAS public transport APIs

Project description

FsHafas

Python client for HAFAS public transport APIs.

The python package is generated from Hafas Client in F# with fable-py, a tool that translates F# source files to Python (currently a prerelease).

Related:

Example

Retrieve journeys:

import asyncio
import sys
from fshafas.fable_modules.fs_hafas_profiles_python.db.profile import profile
from fshafas.hafas_client import HafasClient

async def main(argv) -> int:
    with HafasClient(profile) as client:
        journeys = await client.journeys(argv[0], argv[1])
        for j in journeys.journeys:
            for l in j.legs:
                print(l.origin.name, l.destination.name, l.departure)
    return 0

if __name__ == "__main__":
    asyncio.run(main(sys.argv[1:]))

The class HafasClient corresponds to the Javascript HafasClient interface.

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

fshafas-0.0.13.tar.gz (178.6 kB view hashes)

Uploaded Source

Built Distribution

fshafas-0.0.13-py3-none-any.whl (227.3 kB view hashes)

Uploaded Python 3

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