dashboard.py 805 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from flask import Blueprint, render_template, url_for, request
  5. import requests
  6. __author__ = 'James Iter'
  7. __date__ = '2017/8/17'
  8. __contact__ = 'james.iter.cn@gmail.com'
  9. __copyright__ = '(c) 2017 by James Iter.'
  10. blueprint = Blueprint(
  11. 'v_dashboard',
  12. __name__,
  13. url_prefix='/'
  14. )
  15. def show():
  16. args = list()
  17. resource_path = request.path
  18. host_url = request.host_url.rstrip('/')
  19. guests_url = host_url + url_for('api_guests.r_get_by_filter')
  20. if args.__len__() > 0:
  21. guests_url = guests_url + '?' + '&'.join(args)
  22. guests_ret = requests.get(url=guests_url)
  23. guests_ret = json.loads(guests_ret.content)
  24. return render_template('dashboard.html', guests_ret=guests_ret, resource_path=resource_path)