forked from glitchdotcom/solari-board
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpostJsonp.py
More file actions
22 lines (16 loc) · 778 Bytes
/
Copy pathpostJsonp.py
File metadata and controls
22 lines (16 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import print_function
import json
import sys, os
import cgi
def cgi_callback():
data = [ {'sDate':'today','sTime':'13:30','sDeparture':'foo@example.com','nStatus':1,'nTrack':17, 'fLight':True},
{'sDate':'yesterday','sTime':'16:00','sDeparture':'bar@example.com','nStatus':2,'nTrack':19, 'fLight':False},
{'sDate':'July 8th, 2013','sTime':'16:30','sDeparture':'baz@example.com','nStatus':2,'nTrack':23, 'fLight':False}
]
params = cgi.parse_qs(os.environ['QUERY_STRING'])
print("Content-Type: application/json", end='\n\n')
print ("%s(%s);" % (params['callback'][0], json.dumps(data, sys.stdout)))
if __name__ == '__main__':
cgi_callback()