-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.py
24 lines (22 loc) · 824 Bytes
/
server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import SimpleHTTPServer
import SocketServer
import process
import subprocess
import sys
import urlparse
class myHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
parsed_path = urlparse.urlparse(self.path)
amount = urlparse.parse_qs(parsed_path.query)['amt'][0]
s_name = urlparse.parse_qs(parsed_path.query)['sname'][0]
r_name = urlparse.parse_qs(parsed_path.query)['rname'][0]
print "Sending ", str(amount), " from ", s_name, " to ", r_name
#amount = 100
sys.argv = ['processmain.py', str(amount), s_name, r_name]
execfile("processmain.py")
print self.path
#call(["python", "process.py", amount])
PORT = 8000
handler = SocketServer.TCPServer(("", PORT), myHandler)
print "serving at port 8000"
handler.serve_forever()