# SpaceAPI Server [![pipeline status](https://gitlab.com/s3lph/spaceapi-server/badges/master/pipeline.svg)][master] [![coverage report](https://gitlab.com/s3lph/spaceapi-server/badges/master/coverage.svg)][master] A lightweight server for [SpaceAPI][spaceapi] endpoints. Includes support for pluggable templating, so dynamic content, like sensor values, can be added. ## Dependencies - Python 3 (>=3.6) - [Bottle][pypi-bottle] - [PyYAML][pypi-yaml] ## License [MIT License][mit] ## Introduction This project is an attempt to implement a lightweight, yet versatile SpaceAPI endpoint server. In its simplest configuration, it just serves a plain, static, boring JSON document. In order to provide dynamic content (e.g. whether your space is currently open), you can replace parts of the YAML document (anything except object keys) with custom plugin invocations. These plugins look up and return your dynamic content.
Input | Output |
```yaml --- api: "0.13" space: My Hackerspace # This is a plugin invocation # with no arguments state: !space_state {} sensors: # This is a plugin invocation with # arguments. They are passed to the # plugin function as kwargs. network_connections: !network_connections networks: [ "2.4 GHz", "5 GHz" ] ``` | ```json { "api": "0.13", "state": { "open": true, "lastchange": 1575160777, "message": "Visitors Welcome!" }, "sensors": { "network_connections": [ { "value": 4, "type": "wifi", "name": "2.4 GHz" }, { "value": 7, "type": "wifi", "name": "5 GHz" } ] } } ``` |