Skip to main content

Do requests to the hvv abfahrtsmonitor and get parsed data

Project description

HVV Abfahrtsmonitor

To be used with links generated at https://abfahrten.hvv.de/

Generated urls need to be changed to include api/monitors (See Sample file contents)

Usage

from hvvabfahrtsmonitor import HvvAbfahrtsmonitor
monitor = HvvAbfahrtsmonitor(file, schema_file)
monitor.get_times() #Get a dict of lists of times, in minutes, for when the buses/metros/trains are due next.

Sample file contents (JSON)

{
	"data": [{
			"name": "S",
			"url": "https://abfahrten.hvv.de/api/monitors/a038583f-f72b-4e4e-ba22-9d9903ced316"
		},
		{
			"name": "B",
			"url": "https://abfahrten.hvv.de/api/monitors/f76a6c23-a682-4297-aa99-f815157e2bca"
		}
	]
}

Sample schema_file (JSON schema)

{
  "$schema":"http://json-schema.org/draft-07/schema#",
  "title":"Hvv Schema",
  "definitions":{
    "departure":{
      "type": "object",
      "properties":{
        "delay":{
          "type":"string"
        },
        "direction":{
          "type":"string"
        },
        "hasDelay":{
          "type":"boolean"
        },
        "icon":{
          "type":"object"
        },
        "line":{
          "type":"string"
        },
        "station":{
          "type":"string"
        },
        "time":{
          "type":"string"
        }
      },
      "required": ["hasDelay", "line", "time"]
    }
  },
  "type":"object",
  "properties":{
    "data":{
      "type":"object",
      "properties":{
        "attributes":{
          "type":"object",
          "properties":{
            "departures":{
              "type":"array",
              "items":{"$ref":"#/definitions/departure"}
            }
          }
        }
      }
    }
  }
}

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

hvvabfahrtsmonitor-0.1.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

hvvabfahrtsmonitor-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file hvvabfahrtsmonitor-0.1.1.tar.gz.

File metadata

  • Download URL: hvvabfahrtsmonitor-0.1.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for hvvabfahrtsmonitor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 074e4f6911983a7d66fa29903587260f563fba3dccff9967ea68c57f29c73af8
MD5 7ec6b9fd76bc9cad194d0be8c3a9dc3a
BLAKE2b-256 a1900e0de4b59f58b1a3dde28531fc1baca8f0fb12927a04dc281e34ead6dbd0

See more details on using hashes here.

File details

Details for the file hvvabfahrtsmonitor-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: hvvabfahrtsmonitor-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for hvvabfahrtsmonitor-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9c300ad258bba4847039273e8b4c833bf1d1ef7f7d2086ceb12f746ed7f04be
MD5 f76a3cf81d9f216e0ac6c93b8fa9ebde
BLAKE2b-256 83ecc63bcec999cd6c0999128d449557d81319df41fc20f0cede7b74ae9473dd

See more details on using hashes here.

Supported by

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