meteo-vm2  2.0.11
json-source-ws.py

CGI script to serve the dynamic source table http-source.lua. Requires the Python module bottle to run.

1 #!/usr/bin/env python
2 import bottle
3 
4 @bottle.get("/source.json")
5 def get_source():
6  """
7  Return source table
8  """
9  return {
10  'stations': [{ 'id': i, 'value': i } for i in range(1, 9000)],
11  'variables': [{ 'id': i, 'value': i } for i in range(1, 500) ]
12  }
13 
14 # Run the web server as localhost:8080
15 bottle.run()