Commit e9a1c9545d8c1f731d00646ddc335f0dbd2a2caa
- Diff rendering mode:
- inline
- side by side
server/alipi.py
(13 / 8)
  | |||
14 | 14 | import conf | |
15 | 15 | import oursql | |
16 | 16 | import requests | |
17 | |||
18 | 17 | from flask import jsonify | |
18 | import json | ||
19 | |||
20 | |||
19 | 21 | app = Flask(__name__) | |
20 | 22 | @app.before_request | |
21 | 23 | def first(): | |
… | … | ||
357 | 357 | ||
358 | 358 | @app.route("/askSWeeT",methods=['POST']) | |
359 | 359 | def askSweet(): | |
360 | id = request.form['id'] | ||
361 | response = requests.api.get(conf.SWEETURL[0]"/query/"+id) | ||
362 | collection = g.db['post'] | ||
363 | if response.status_code == 200: | ||
364 | collection.insert(response.json) | ||
365 | reply = make_response() | ||
366 | return reply | ||
360 | data = json.loads(request.form['data']) | ||
361 | for i in data: | ||
362 | response = requests.api.get(conf.SWEETURL[0]+"/query/"+i['id']) | ||
363 | collection = g.db['post'] | ||
364 | rep = response.json() | ||
365 | rep['bxpath'] = '' | ||
366 | if response.status_code == 200: | ||
367 | collection.insert(rep) | ||
368 | reply = make_response() | ||
369 | return reply | ||
367 | 370 | ||
368 | 371 | @app.route("/menu",methods=['GET']) | |
369 | 372 | def menuForDialog(): |
server/wsgi/pageEditor.js
(4 / 5)
  | |||
401 | 401 | }); | |
402 | 402 | $.post(config.sweet+'/add', {data : JSON.stringify(util.buildDataString())}, | |
403 | 403 | function(data){ | |
404 | data = JSON.parse(data); | ||
405 | for(var i in data){ | ||
406 | $.post(config.deploy+'/askSWeeT',{'id':data[i]['id']},function(){ | ||
407 | console.log("success!!");}); | ||
408 | } | ||
404 | // data = JSON.parse(data); | ||
405 | $.post(config.deploy+'/askSWeeT',{'data':data},function(){ | ||
406 | console.log("success!!");}); | ||
407 | |||
409 | 408 | }); //+'&title='+encodeURIComponent(document.title) | |
410 | 409 | // }).done(function(){ | |
411 | 410 | // console.log("test"); |