All sensors sending to server via http

Dependencies:   C12832 CCS811 MMA7660 Sht31 TSL2561 mbed-http vl53l0x_api

Fork of HTTP-Python-Demo by Cambridge Hackathon

Committer:
Jenny Plunkett
Date:
Tue Nov 14 14:26:53 2017 -0600
Revision:
0:c5b042cf8162
Blank program (with working/ code) for tutorial

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jenny Plunkett 0:c5b042cf8162 1 from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
Jenny Plunkett 0:c5b042cf8162 2 import SocketServer
Jenny Plunkett 0:c5b042cf8162 3 import socket
Jenny Plunkett 0:c5b042cf8162 4
Jenny Plunkett 0:c5b042cf8162 5 class MyHandler(BaseHTTPRequestHandler):
Jenny Plunkett 0:c5b042cf8162 6
Jenny Plunkett 0:c5b042cf8162 7 # HTTP REQUESTS HERE
Jenny Plunkett 0:c5b042cf8162 8
Jenny Plunkett 0:c5b042cf8162 9
Jenny Plunkett 0:c5b042cf8162 10
Jenny Plunkett 0:c5b042cf8162 11 def run():
Jenny Plunkett 0:c5b042cf8162 12 httpd = HTTPServer(('', 8080), MyHandler)
Jenny Plunkett 0:c5b042cf8162 13 print "HTTP server running on port 8080"
Jenny Plunkett 0:c5b042cf8162 14 print "Your IP address is: ", socket.gethostbyname(socket.gethostname())
Jenny Plunkett 0:c5b042cf8162 15 httpd.serve_forever()
Jenny Plunkett 0:c5b042cf8162 16
Jenny Plunkett 0:c5b042cf8162 17 if __name__ == '__main__':
Jenny Plunkett 0:c5b042cf8162 18 run()