
response = urllib2.urlopen(B'status.json')
if response:
status = json.loads(response.read())
print 'Sensor laser is %s, motor rpm is %s' % \
(status['laser']['state'], status['motor']['rpm'])
sensor.close()
Typical output looks like the following:
http://192.168.1.201/cgi/reset data=reset_system: 204 (OK)
http://192.168.1.201/cgi/setting rpm=300: 204 (OK)
http://192.168.1.201/cgi/setting laser=on: 204 (OK)
Sensor laser is On, motor rpm is 301
Chapter 10 • Sensor Communication
85
DRAFT