python简单的自动化操作1
import requests #引入requests库 import bs4 #引入bs4库 session=requests.Session() #调用库里的Session()方法 r=session.get('http://127.0.0.1:80/sysbench/tuninglog/create/')#访问这个路径 soup = bs4.BeautifulSoup(r.text,"html.parser")#调用bs4.BeautifulSoup()方法 csrf = soup.find('input',type='hidden')#查找元素 value = csrf['value'] data = {'csrfmiddlewaretoken':value,'name': 'xya','step': 11111} r = session.post('http://127.0.0.1:80/sysbench/tuninglog/create/',data=data)