The NPO pages api is actually meant to facilitate searching in your site.
The objects it contains are quite complete though. This is a simple demo on how it could be used to actually serve a site via it.
It is implemented with python flask.
The makefile documents how to run it.
The app can be configured with the following environment variables:
-
secret: The NPO api secret
-
apiKey: The NPO apiKey. This defaults to key of vpro
-
origin: The NPO origin. This defaults to https://www.vpro.nl
-
profile: The profile to base the site on. Defaults to vpro
-
configdir: Set this to the cwd to get mentioned defaults working
Set up pyapi, with flask (pip install flask
) and run
export secret=<see 1password or so>
configdir=$(pwd) profile=vpro flask run
I prepared a docker image with required dependencies too:
docker run --env secret=${secret} --env profile=vpro -p 8080:8080 mihxil/npoapi-pages
Via make:
make docker-run PROFILE=vpro
(it should be pulled from hub.docker.io. Nothing else needed. Just keep port 8080 free.)