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.

Files for hvvabfahrtsmonitor, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size hvvabfahrtsmonitor-0.1.1-py3-none-any.whl (4.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size hvvabfahrtsmonitor-0.1.1.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page