向hvv abfahrtsmonitor发出请求并获取解析数据

hvvabfahrtsmonitor的Python项目详细描述


hvv abfahrtsmonitor

与在https://abfahrten.hvv.de/生成的链接一起使用

生成的URL需要更改为包含API/监视器(请参见示例文件内容)

用法

fromhvvabfahrtsmonitorimportHvvAbfahrtsmonitormonitor=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.

示例文件内容(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"}]}

模式文件示例(json模式)

{"$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"}}}}}}}}

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java能否使用OpenJPA将一个实体持久化到多个持久化单元?   java如何访问当前按下的键   java singleton是否意味着哈希代码总是返回相同的值?   inputstream无法在Java中同时使用STDIN和STDERR读取程序输出   java运行时有多贵。getRuntime()与获取内存度量相结合   java AndroidStudio ListView适配器更新   java小程序请求未扩展实时会话   java是设置布尔值所必需的关键部分?   java比较两个字符串,并突出显示发现的不匹配项   java带抽屉布局,无论哪个屏幕处于活动状态,如何在按下后退键时关闭应用程序?   爪哇:颜色有什么区别。黑色和彩色。黑色   Velocity模板中子类的java访问方法   java如何快速学习Drools或其他规则引擎   从Java应用程序访问时缓存数据库查询结果   java cassandra nodetool JPLISAgent。c错误   java我正在解析一个没有pubDate的RSS提要,有没有其他方法可以确定一个项目是何时发布的?