misc: script to update content from the www site
This commit is contained in:
parent
c27f35dcdd
commit
77c470c840
2
Makefile
2
Makefile
|
@ -21,6 +21,8 @@ install:
|
|||
mkdir -p $(DESTDIR)$(prefix)/share/authentic2/vincennes
|
||||
mkdir -p $(DESTDIR)$(prefix)/share/publik/themes/vincennes-2014
|
||||
mkdir -p $(DESTDIR)$(prefix)/share/wcs/themes/vincennes-2014
|
||||
mkdir -p $(DESTDIR)$(prefix)/sbin/
|
||||
cp update-vincennes-content.py $(DESTDIR)$(prefix)/sbin/
|
||||
cp -r idp/* $(DESTDIR)$(prefix)/share/authentic2/vincennes
|
||||
cp -r static templates $(DESTDIR)$(prefix)/share/publik/themes/vincennes-2014
|
||||
cp -r desc.xml template.py wcs.css dataview.js $(DESTDIR)$(prefix)/share/wcs/themes/vincennes-2014
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#! /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()
|
Reference in New Issue