Python module providing access to the opening_hours.js library which is written in JavaScript.
Project description
Python module providing access to the opening_hours.js library which is written in JavaScript.
This python library only implements the simple API from opening_hours.js at the moment (without optional parameters).
Installation
Install `pyopening_hours <https://pypi.python.org/pypi/pyopening_hours/>`__ simply by using pip:
pip install pyopening_hours
Usage
import pyopening_hours
try:
oh = pyopening_hours.OpeningHours(u'Lun-')
except pyopening_hours.ParseException as error:
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('Parsing complex value: %s' % value)
print('Is%s week stable' % ('' if oh.isWeekStable() else ' not'))
print('Facility is %s' % oh.getStateString())
print('Next change in UTC: %s' % oh.getNextChange().strftime('%Y-%m-%d %H:%M:%S'))
print('Warnings:')
for line in oh.getWarnings():
print(' ' + line)
Development
Just clone the repository with
git clone https://github.com/ypid/pyopening_hours
and install it’s dependencies (execute inside the repository):
make installDependencies
Used by other projects
This library is used in the following projects:
Other modules
osm-opening-hours (pure python implementation)
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
pyopening_hours-0.1.2.tar.gz
(954.6 kB
view hashes)
Built Distribution
Close
Hashes for pyopening_hours-0.1.2.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ace20e0225bf5216ecaa7548f1d6f5b2d1eb13e346f9119a01dd1b9c62f69db7 |
|
MD5 | 5727adee3e3516a267cc767bb5538347 |
|
BLAKE2b-256 | bc99dd6e17732a7befc6be83f5b5e2a7add9234d4cc8e614d323618c5b3570eb |