Python module providing access to the opening_hours.js library which is written in JavaScript.
Project description
# pyopening_hours
[](https://travis-ci.org/ypid/pyopening_hours)
Python module providing access to the [opening_hours.js][oh-lib] library which is written in JavaScript.
[oh-lib]: https://github.com/ypid/opening_hours.js
This python library only implements the [simple API](https://github.com/ypid/opening_hours.js#simple-api) from opening_hours.js at the moment (without optional parameters).
## Install
Just clone the repository with
```
git clone https://github.com/ypid/pyopening_hours
```
and install it’s dependencies (execute inside the repository):
```
npm install
```
## Usage
```python
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)
```
## Used by other projects
This library is used in the following projects:
* [opening\_hours\_bot][]
[opening\_hours\_bot]: https://github.com/ypid/opening_hours_bot
## Other modules
* [osm-opening-hours](https://github.com/martinfilliau/osm-opening-hours) (pure python implementation)
[](https://travis-ci.org/ypid/pyopening_hours)
Python module providing access to the [opening_hours.js][oh-lib] library which is written in JavaScript.
[oh-lib]: https://github.com/ypid/opening_hours.js
This python library only implements the [simple API](https://github.com/ypid/opening_hours.js#simple-api) from opening_hours.js at the moment (without optional parameters).
## Install
Just clone the repository with
```
git clone https://github.com/ypid/pyopening_hours
```
and install it’s dependencies (execute inside the repository):
```
npm install
```
## Usage
```python
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)
```
## Used by other projects
This library is used in the following projects:
* [opening\_hours\_bot][]
[opening\_hours\_bot]: https://github.com/ypid/opening_hours_bot
## Other modules
* [osm-opening-hours](https://github.com/martinfilliau/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.1.tar.gz
(954.5 kB
view hashes)
Built Distribution
Close
Hashes for pyopening_hours-0.1.1.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98f72798f2d23234f509f1602e525df70fd79cab9fbdb2bce857e9602c5b3974 |
|
MD5 | c4a24861cc72d4fee4a12f5f2cbec4d1 |
|
BLAKE2b-256 | 68a266728190e32256ebc0de75e584be7fc34a2f28a9bee97b91f93c3bb7ce94 |