You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.0 KiB
46 lines
1.0 KiB
import json
|
|
import requests
|
|
from flask import Flask
|
|
from flask import render_template, request, Response
|
|
import xmlrpc.client
|
|
|
|
s = xmlrpc.client.ServerProxy('http://localhost:8000')
|
|
app = Flask(__name__)
|
|
|
|
|
|
@app.route('/', strict_slashes=False)
|
|
def index():
|
|
return render_template('index.html')
|
|
|
|
@app.route('/order', methods=['POST'])
|
|
def order():
|
|
candy1 = int(request.form['candy1'])
|
|
candy2 = int(request.form['candy2'])
|
|
candy3 = int(request.form['candy3'])
|
|
candy4 = int(request.form['candy4'])
|
|
print ("test {} {} {} {} ".format(candy1, candy2, candy3, candy4))
|
|
params = []
|
|
s = {}
|
|
s['img_idx'] = 0
|
|
s['loaded'] = 0
|
|
s['required'] = candy1
|
|
test_candy_stat.append(s)
|
|
s['img_idx'] = 1
|
|
s['loaded'] = 0
|
|
s['required'] = candy2
|
|
test_candy_stat.append(s)
|
|
s['img_idx'] = 2
|
|
s['loaded'] = 0
|
|
s['required'] = candy3
|
|
test_candy_stat.append(s)
|
|
s['img_idx'] = 3
|
|
s['loaded'] = 0
|
|
s['required'] = candy4
|
|
test_candy_stat.append(s)
|
|
s.new_order(params)
|
|
return '{"status":"ok"}'
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app.run('0.0.0.0')
|