api_setting.py 737 B

123456789101112131415161718192021
  1. from .tool.func import *
  2. def api_setting(name = 'markup'):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. ok_list_1 = ['markup']
  6. ok_list_2 = ['inter_wiki']
  7. if name in ok_list_1:
  8. curs.execute(db_change('select data from other where name = ?'), [name])
  9. rep_data = curs.fetchall()
  10. if rep_data:
  11. return flask.jsonify({ name : rep_data })
  12. elif name in ok_list_2:
  13. curs.execute(db_change("select html, plus, plus_t from html_filter where kind = ?"), [name])
  14. rep_data = curs.fetchall()
  15. if rep_data:
  16. return flask.jsonify({ name : rep_data })
  17. return flask.jsonify({})