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:

  • hafas-client JavaScript client for HAFAS public transport APIs,
  • FPTF Friendly Public Transport Format.

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.5.tar.gz (169.3 kB view details)

Uploaded Source

Built Distribution

fshafas-0.0.5-py3-none-any.whl (207.9 kB view details)

Uploaded Python 3

File details

Details for the file fshafas-0.0.5.tar.gz.

File metadata

  • Download URL: fshafas-0.0.5.tar.gz
  • Upload date:
  • Size: 169.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.1.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for fshafas-0.0.5.tar.gz
Algorithm Hash digest
SHA256 1ac415d7731d29dc4b5113df795cddf1dd06ed184ad9476f29ff76da2cdc1aa0
MD5 2f821f50a2e6fadcde76d3a2a1d23af9
BLAKE2b-256 df865377c64e0952b3efb8914052ec3eab1d1723b45ae069345dd1a22c4baca7

See more details on using hashes here.

File details

Details for the file fshafas-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: fshafas-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 207.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.1.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for fshafas-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8e4bd4ee2d0d7f7c1bc97ee982ccbc904596c80144e2ad99c9af3d68c82029f0
MD5 24bc935829a83606d32f23a41aa4e11e
BLAKE2b-256 5a6e935953f55e194f4485ddc4d58eec4e98a738254465c05e4accbca5de167f

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