xubao_api.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import traceback
  2. import flask
  3. import time
  4. import datetime
  5. from flask import Blueprint
  6. from flask_cors import CORS
  7. from dateutil.relativedelta import relativedelta
  8. from spiders.hengbang.xubao.hb_xubao import HB_xubao
  9. from spiders.ansheng.xubao.as_xubao import AS_xubao
  10. from spiders.pingan.xubao.pa_xubao import PA_xubao
  11. from spiders.yongcheng.xubao.yc_xubao import YC_xubao
  12. from spiders.zhongmei.xubao.zm_xubao import ZM_xubao
  13. xubao=Blueprint('xubao',__name__)
  14. CORS(xubao, supports_credentials=True)
  15. @xubao.route('/hb/xubao', methods=['post'])
  16. def hb_xubao():
  17. license = flask.request.json.get('license')
  18. uname = flask.request.json.get('uname')
  19. pwd = flask.request.json.get('pwd')
  20. ret = HB_xubao(uname, pwd, license).main()
  21. return ret, 200, {'Content-Type': 'application/json'}
  22. @xubao.route('/yc/xubao', methods=['post'])
  23. def yc_xubao():
  24. license = flask.request.json.get('license')
  25. uname = flask.request.json.get('uname')
  26. pwd = flask.request.json.get('pwd')
  27. ret = YC_xubao(uname, pwd, license).main()
  28. return ret, 200, {'Content-Type': 'application/json'}
  29. @xubao.route('/as/xubao', methods=['post'])
  30. def as_xubao():
  31. license = flask.request.json.get('license')
  32. uname = flask.request.json.get('uname')
  33. pwd = flask.request.json.get('pwd')
  34. ret = AS_xubao(uname, pwd, license).main()
  35. return ret, 200, {'Content-Type': 'application/json'}
  36. @xubao.route('/pingan/xubao', methods=['post'])
  37. def pa_xubao():
  38. vin = flask.request.json.get('vin')
  39. uname = flask.request.json.get('uname')
  40. pwd = flask.request.json.get('pwd')
  41. ret = PA_xubao(uname, pwd, vin).main()
  42. return ret, 200, {'Content-Type': 'application/json'}
  43. @xubao.route('/zm/xubao', methods=['post'])
  44. def zm_xubao():
  45. license = flask.request.json.get('license')
  46. uname = flask.request.json.get('uname')
  47. pwd = flask.request.json.get('pwd')
  48. ret = ZM_xubao(uname, pwd, license).main()
  49. return ret, 200, {'Content-Type': 'application/json'}