Update to SpaceAPI schema 15
This commit is contained in:
parent
14dfb79cfb
commit
305f0fa99f
2 changed files with 24 additions and 17 deletions
38
server.py
38
server.py
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import paho.mqtt.client as mqtt
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import paho.mqtt.client as mqtt
|
||||||
import tornado.ioloop
|
import tornado.ioloop
|
||||||
import tornado.web
|
import tornado.web
|
||||||
|
|
||||||
|
|
||||||
PORT = 8888
|
PORT = 8888
|
||||||
BASE_URL = "https://bitlair.nl/state"
|
BASE_URL = "https://bitlair.nl/state"
|
||||||
MQTT_HOST = "bitlair.nl"
|
MQTT_HOST = "bitlair.nl"
|
||||||
|
@ -18,25 +18,21 @@ current_state_change = time.time()
|
||||||
def state():
|
def state():
|
||||||
global current_state, current_state_change
|
global current_state, current_state_change
|
||||||
return {
|
return {
|
||||||
"api": "0.13",
|
"api_compatibility": ["15"],
|
||||||
"space": "Bitlair",
|
"space": "Bitlair",
|
||||||
"logo": BASE_URL + "/logo.png",
|
"logo": BASE_URL + "/logo.png",
|
||||||
"url": "https://bitlair.nl/",
|
"url": "https://bitlair.nl/",
|
||||||
"contact": {
|
|
||||||
"irc": "irc://irc.smurfnet.ch/bitlair",
|
|
||||||
"twitter": "@bitlair",
|
|
||||||
"email": "bestuur@bitlair.nl",
|
|
||||||
"ml": "general@list.bitlair.nl",
|
|
||||||
},
|
|
||||||
"spacefed": {
|
|
||||||
"spacenet": True,
|
|
||||||
"spacesaml": True,
|
|
||||||
"spacephone": False,
|
|
||||||
},
|
|
||||||
"location": {
|
"location": {
|
||||||
"address": "Nijverheidsweg-Noord 77, 3812 PK Amersfoort, The Netherlands",
|
"address": "Nijverheidsweg-Noord 77, 3812 PK Amersfoort, The Netherlands",
|
||||||
"lat": 52.1697399,
|
"lat": 52.1697399,
|
||||||
"lon": 5.3561364,
|
"lon": 5.3561364,
|
||||||
|
"timezone": "Europe/Amsterdam",
|
||||||
|
"country_code": "NL",
|
||||||
|
"hint": "Ingang aan de oost-zijde van het pand, blauwe deur",
|
||||||
|
},
|
||||||
|
"spacefed": {
|
||||||
|
"spacenet": True,
|
||||||
|
"spacesaml": True,
|
||||||
},
|
},
|
||||||
"state": {
|
"state": {
|
||||||
"open": current_state,
|
"open": current_state,
|
||||||
|
@ -45,6 +41,7 @@ def state():
|
||||||
"open": BASE_URL + "/open.png",
|
"open": BASE_URL + "/open.png",
|
||||||
"closed": BASE_URL + "/closed.png",
|
"closed": BASE_URL + "/closed.png",
|
||||||
},
|
},
|
||||||
|
# mqtt is out-of-spec
|
||||||
"mqtt": {
|
"mqtt": {
|
||||||
"host": "bitlair.nl",
|
"host": "bitlair.nl",
|
||||||
"port": 1883,
|
"port": 1883,
|
||||||
|
@ -54,7 +51,18 @@ def state():
|
||||||
"open": "open",
|
"open": "open",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"issue_report_channels": ["twitter"],
|
"contact": {
|
||||||
|
"irc": "irc://irc.smurfnet.ch/bitlair",
|
||||||
|
"mastodon": "@bitlair@hsnl.social",
|
||||||
|
"email": "bestuur@bitlair.nl",
|
||||||
|
"ml": "general@list.bitlair.nl",
|
||||||
|
},
|
||||||
|
"feeds": {
|
||||||
|
"calendar": {
|
||||||
|
"type": "ical",
|
||||||
|
"url": "https://bitlair.nl/events.ics",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
import requests
|
import requests
|
||||||
from jsonschema import validate
|
from jsonschema import validate
|
||||||
|
|
||||||
|
|
||||||
import server
|
import server
|
||||||
|
|
||||||
|
|
||||||
def test_schema_compliance():
|
def test_schema_compliance():
|
||||||
resp = requests.get(
|
resp = requests.get(
|
||||||
"https://raw.githubusercontent.com/SpaceApi/schema/refs/heads/master/13.json"
|
"https://raw.githubusercontent.com/SpaceApi/schema/refs/heads/master/15.json"
|
||||||
)
|
)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
schema = resp.json()
|
schema = resp.json()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue