I am trying to do something that I assume is very simple, but since I am fairly new to Python I haven\'t been able to find out how. I need to execute a function in my Python
This is indeed very simple to do in python:
import SocketServer
from BaseHTTPServer import BaseHTTPRequestHandler
def some_function():
print "some_function got called"
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/captureImage':
# Insert your code here
some_function()
self.send_response(200)
httpd = SocketServer.TCPServer(("", 8080), MyHandler)
httpd.serve_forever()
Depending on where you want to go from here, you might want to checkout the documentation for BaseHttpServer, or look into a more full featured web framework like Django.