from requests import get,post,Session
@app.route('/access_admin_url',methods=['POST'])
def access_admin_url():
dict = request.form
login_url = dict.get('login_url')
site_user = dict.get('site_user')
site_pass = dict.get('site_pass')
access_url = dict.get('access_url')
payload = {'username':site_user,'password':site_pass}
headers = {'user-agent': 'my-test/auto_login'}
S = Session()
R_1 = S.get(login_url,headers=headers)
R_2 = S.post(login_url,headers=headers,data=payload)
R_3 = S.get(access_url,headers=headers)
文章评论