我有一个 sh 脚本代码,需要将其转换为 python 脚本。我正在努力寻找相应的命令。
所以这是我的 sh 脚本
RESPONSE=`curl -s -X GET http://192.168.8.1/api/webserver/SesTokInfo`
COOKIE=`echo "$RESPONSE"| grep SessionID=| cut -b 10-147`
TOKEN=`echo "$RESPONSE"| grep TokInfo| cut -b 10-41`
DATA="<request><PageIndex>1</PageIndex><ReadCount>3</ReadCount>
<BoxType>1</BoxType><SortType>0</SortType><Ascending>0</Ascending>
<UnreadPreferred>1</UnreadPreferred></request>"
curl -b $COOKIE -c $COOKIE -H "X-Requested-With: XMLHttpRequest" --data
"$DATA" http://192.168.8.1/api/sms/sms-list --header
"__RequestVerificationToken: $TOKEN" --header "Content-Type:text/xml"
所以我用不同的特定标签返回我的 html 页面的前 3 个最新结果
我想用python写一个可以做同样的脚本
谢谢