python模块提供对用javascript编写的opening_hours.js库的访问。
pyopening_hours的Python项目详细描述
提供对 opening_hours.js库 它是用javascript编写的。
这个python库只实现 此时打开_hours.js(无可选参数)。
用法
importpyopening_hourstry:oh=pyopening_hours.OpeningHours(u'Lun-')exceptpyopening_hours.ParseExceptionaserror:print(error.message)value=u'Mon,Tu,Th,Fr 12:00-18:00; Samstag 12:00-17:00 "I ❤ unicode"; Th[3] OFF; Th[-1] off'oh=pyopening_hours.OpeningHours(value)print(u"Parsing complex value: {}".format(value))print(u"Is{} week stable".format(''ifoh.isWeekStable()else' not'))print(u"Facility is {}".format(oh.getStateString()))print(u"Next change in UTC: {}".format(oh.getNextChange().strftime('%Y-%m-%d %H:%M:%S')))print(u"Warnings:")forlineinoh.getWarnings():print(' '+line)
开发
只需使用
git clone https://github.com/ypid/pyopening_hours
并安装它的依赖项(在存储库中执行):
make dependencies-get
其他模块
- osm-opening-hours (纯python实现)