from flask import Flask, request, render_template, send_file


app = Flask(__name__)


@app.route('/')
def index():
    return render_template('index.html')
@app.route('/px2.js')
def js():
    return send_file('templates/px2.js', )
@app.route('/mouse.js')
def mouse():
    return send_file('templates/mouse.js', )
@app.route('/env/px/env', methods=["POST"])
def collect():
    print('env.',request.data.decode())
    return 'ok'

@app.route('/px/env/mouse', methods=["POST"])
def mouses():
    print('mouse.',request.data.decode())
    return 'ok'
@app.route('/collect/mouse', methods=["POST"])
def collectMouse():
    print(request.data.decode())
    return 'ok'
if __name__ == '__main__':
    # app.run(host='0.0.0.0',debug=True, port=11233)
    import random

    username = 'brd-customer-hl_70986309-zone-isp'
    password = 'ozfawewfxj8y'
    port = 22225
    session_id = random.random()
    super_proxy_url = ('http://%s-session-%s:%s@brd.superproxy.io:%d' %
                       (username, session_id, password, port))
    print(super_proxy_url)