public
Description: A base class for HTTP based activities for the OLPC laptop
Homepage: https://www.socialtext.net/lukec/index.cgi?httpactivity
Clone URL: git://github.com/lukec/httpactivity.git
httpactivity / XOHTTPStatus.py
100644 22 lines (16 sloc) 0.406 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import json
 
filename = 'web/status.json'
 
def initialize():
    write_status({'command': 'idle'})
 
def read_status():
    fh = open(filename, 'r')
    content = fh.read()
    return json.read(content)
 
def write_status(opts):
    fh = open(filename, 'w')
    fh.write(json.write(opts))
    fh.close()
 
# For testing
if __name__ == '__main__':
    status = read()
    print "Command: %s"%status['command']