Skip to content
Permalink
Browse files

Use remote URLs for data

  • Loading branch information...
AntoineAugusti committed Jan 2, 2019
1 parent 0fdb4d0 commit 4f84dab1765b57f202acf949a838a18c583ae9a4
Showing with 9 additions and 2,422 deletions.
  1. +9 −4 build.py
  2. +0 −1,108 jours_feries_seuls.csv
  3. +0 −1,310 jours_feries_seuls_alsace_moselle.csv
@@ -2,17 +2,22 @@
import os
import json
from collections import defaultdict
from urllib.request import urlopen
from io import StringIO

DATA_GOUV = 'https://www.data.gouv.fr/s/resources/jours-feries-en-france/'

modes = [
('data/', 'jours_feries_seuls.csv'),
('data/alsace-moselle/', 'jours_feries_seuls_alsace_moselle.csv'),
('data/', DATA_GOUV + '20180704-205342/jours_feries_seuls.csv'),
('data/alsace-moselle/', DATA_GOUV + '20180705-154059/jours_feries_seuls_alsace_moselle.csv'),
]

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

reader = csv.DictReader(open(filename))
response = urlopen(url).read().decode('utf-8')
reader = csv.DictReader(StringIO(response))

data_by_year = defaultdict(list)
for row in reader:
Oops, something went wrong.

0 comments on commit 4f84dab

Please sign in to comment.
You can’t perform that action at this time.