-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME.mdpp
84 lines (57 loc) · 2.35 KB
/
README.mdpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# ferien-api
[![PyPI version](https://badge.fury.io/py/ferien-api.svg)](https://badge.fury.io/py/ferien-api)
[![Build Status](https://travis-ci.org/HazardDede/ferien-api.svg?branch=master)](https://travis-ci.org/HazardDede/ferien-api)
[![Coverage Status](https://coveralls.io/repos/github/HazardDede/ferien-api/badge.svg?branch=master)](https://coveralls.io/github/HazardDede/ferien-api?branch=master)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
> Python client library for ferien-api.de
## Installation
`ferien-api` needs python 3.5+ to function properly
```
pip install ferien-api
```
## Usage
You could use the synchronous implementation which will block until a response arrives from the api
or you could use the async implementation which will be non-blocking your other async stuff.
**Synchronous**:
!INCLUDECODE "./examples/run_sync.py" (python)
**Asynchronous**:
!INCLUDECODE "./examples/run_async.py" (python)
Both implementations of `all_vacations` and `state_vacations` will return a list of `Vacation` data objects.
See below for the definition of a `Vacation` object.
```python
Vacation(
start=datetime.datetime(2020, 12, 21, 0, 0),
end=datetime.datetime(2021, 1, 5, 0, 0),
year=2020,
state_code='HH',
name='weihnachtsferien',
slug='weihnachtsferien-2020-HH'
)
```
*Please note*: All datetime objects are in the `Europe/Berlin (CET/CEST)` timezone
Using the async version it is easy to make multiple requests in "parallel" (not true... you know that when you are
an asyncio enthusiast) and save a lot of time:
!INCLUDECODE "./examples/run_async_gather.py" (python)
## Changelog
**0.3.7**
* Adapts the vacation date parsing logic to the new ferien-api standard (#8)
* Fixes some linting errors using the latest linter / mypy (#8)
**0.3.6**
* Removes unnecessary print statement in utils.py
**0.3.5**
* Adds strptime fallback for Z remainder (#5)
**0.3.4**
* Fixes incorrect localization to Europe/Berlin for dates
**0.3.3**
* Changes all timestamps from naive to 'Europe/Berlin'
**0.3.2**
* Adds type hints to codebase
* Adds mypy as a linter
**0.3.1**
* Adds pylint as a linter and make him happy!
**0.3.0**
* Adds `current_vacation` and `next_vacation` implementations
**0.2.0**
* Adds an async implementation of `all_vacations` and `state_vacations`
**0.1.0**
* Initial version