0

我有一个 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写一个可以做同样的脚本

谢谢

4

1 回答 1

0

希望你知道 shell 和 python 是不同的语言,因此工作方式不同,我把Scrapyrequests正则表达式交给你。

看你搜索问题的质量,我想你应该能达到你想要的。

于 2019-10-01T08:13:02.110 回答