This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
vincennes-2014/update-vincennes-content.py

20 lines
515 B
Python
Executable File

#! /usr/bin/env python
import os
import requests
CACHE_DIR = '/var/cache/vincennes'
if not os.path.exists(CACHE_DIR):
os.mkdir(CACHE_DIR)
PARTS = ['menu', 'demarches', 'partenaires', 'agenda', 'magazine', 'autopromo',
'services', 'acces-directs', 'kiosque', 'grand-projets', 'actualites']
for part in PARTS:
r = requests.get('https://www.vincennes.fr/api/data/(Element)/' + part)
r.raise_for_status()
fd = file(os.path.join(CACHE_DIR, part), 'w')
fd.write(r.content)
fd.close()