from flask import Flask, render_template
import requests

app = Flask(__name__)


@app.route('/index')
def hello_world():
    url = 'http://ssp-manager.tuia.cn/wchatDomain/wechatScan/patrolListing'
    r = requests.get(url)
    if r.ok:
        list = r.json().get('data')
        if len(list) > 0:
            domain_list = []
            for i in list:
                domain_list.append('https://'+i.get('domainName'))

    return render_template('index.html', u=domain_list)


if __name__ == '__main__':
    app.run()
