Permalink
Browse files

First commit

  • Loading branch information...
AntoineAugusti committed Jan 2, 2019
0 parents commit b298d5fff62f7211dc6b18c20b49cd11fa1ef3f6
Showing with 2,498 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +21 −0 LICENSE.md
  3. +28 −0 README.md
  4. +2 −0 _headers
  5. +2 −0 _redirects
  6. +25 −0 build.py
  7. +1,108 −0 jours_feries_seuls.csv
  8. +1,310 −0 jours_feries_seuls_alsace_moselle.csv
  9. +1 −0 runtime.txt
@@ -0,0 +1 @@
data
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Antoine Augusti

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,28 @@
# API Jours Fériés France
Une API pour lister les jours fériés en France. Ceci se base sur les données [du package suivant](https://github.com/AntoineAugusti/jours-feries-france).

## Déploiement et hébergement
Le déploiement est assuré par Netlify, le fichier de build se trouve dans `build.py`.

## Endpoints
Les endpoints retournent des données au format JSON.

- Les jours fériés pour une année : `https://jours-feries-france.antoine-augusti.fr/api/:annee`

Exemple :
- https://jours-feries-france.antoine-augusti.fr/api/2019
```json
[{"date": "2019-01-01", "est_jour_ferie": "True", "nom_jour_ferie": "Jour de l'an"}, {"date": "2019-04-22", "est_jour_ferie": "True", "nom_jour_ferie": "Lundi de Pâques"}, {"date": "2019-05-01", "est_jour_ferie": "True", "nom_jour_ferie": "Fête du travail"}, {"date": "2019-05-08", "est_jour_ferie": "True", "nom_jour_ferie": "Victoire des alliés"}, {"date": "2019-05-30", "est_jour_ferie": "True", "nom_jour_ferie": "Ascension"}, {"date": "2019-06-10", "est_jour_ferie": "True", "nom_jour_ferie": "Pentecôte"}, {"date": "2019-07-14", "est_jour_ferie": "True", "nom_jour_ferie": "Fête Nationale"}, {"date": "2019-08-15", "est_jour_ferie": "True", "nom_jour_ferie": "Assomption"}, {"date": "2019-11-01", "est_jour_ferie": "True", "nom_jour_ferie": "Toussaint"}, {"date": "2019-11-11", "est_jour_ferie": "True", "nom_jour_ferie": "Armistice"}, {"date": "2019-12-25", "est_jour_ferie": "True", "nom_jour_ferie": "Noël"}]
```

- Les jours fériés pour une année, en Alsace-Moselle : `https://jours-feries-france.antoine-augusti.fr/api/alsace-moselle/:annee`

Exemple :
- https://jours-feries-france.antoine-augusti.fr/api/alsace-moselle/2019
```json
[{"date": "2019-01-01", "est_jour_ferie": "True", "nom_jour_ferie": "Jour de l'an"}, {"date": "2019-04-19", "est_jour_ferie": "True", "nom_jour_ferie": "Vendredi Saint"}, {"date": "2019-04-22", "est_jour_ferie": "True", "nom_jour_ferie": "Lundi de Pâques"}, {"date": "2019-05-01", "est_jour_ferie": "True", "nom_jour_ferie": "Fête du travail"}, {"date": "2019-05-08", "est_jour_ferie": "True", "nom_jour_ferie": "Victoire des alliés"}, {"date": "2019-05-30", "est_jour_ferie": "True", "nom_jour_ferie": "Ascension"}, {"date": "2019-06-10", "est_jour_ferie": "True", "nom_jour_ferie": "Pentecôte"}, {"date": "2019-07-14", "est_jour_ferie": "True", "nom_jour_ferie": "Fête Nationale"}, {"date": "2019-08-15", "est_jour_ferie": "True", "nom_jour_ferie": "Assomption"}, {"date": "2019-11-01", "est_jour_ferie": "True", "nom_jour_ferie": "Toussaint"}, {"date": "2019-11-11", "est_jour_ferie": "True", "nom_jour_ferie": "Armistice"}, {"date": "2019-12-25", "est_jour_ferie": "True", "nom_jour_ferie": "Noël"}, {"date": "2019-12-26", "est_jour_ferie": "True", "nom_jour_ferie": "Saint Étienne"}]
```


## Licence
MIT
@@ -0,0 +1,2 @@
/api/*
Cache-Control: public, max-age=3600
@@ -0,0 +1,2 @@
/api/alsace-moselle/:year /data/alsace-moselle/:year.json 200
/api/:year /data/:year.json 200
@@ -0,0 +1,25 @@
import csv
import os
import json
from collections import defaultdict

modes = [
('data/', 'jours_feries_seuls.csv'),
('data/alsace-moselle/', 'jours_feries_seuls_alsace_moselle.csv'),
]

for mode in modes:
base_path, filename = mode
os.makedirs(base_path, exist_ok=True)

reader = csv.DictReader(open(filename))

data_by_year = defaultdict(list)
for row in reader:
year = row['date'][0:4]
data_by_year[year].append(row)

for year in data_by_year:
filename = base_path + year + '.json'
with open(filename, 'w') as f:
json.dump(data_by_year[year], f, ensure_ascii=False)
Oops, something went wrong.

0 comments on commit b298d5f

Please sign in to comment.