Board logo

标题: [问题求助] 用python改写一个power shell命令 [打印本页]

作者: wujunkai    时间: 2020-5-31 16:50     标题: 用python改写一个power shell命令

命令如下
  1. Invoke-WebRequest -Uri "http://www.musictool.top/" `
  2. -Method "POST" `
  3. -Headers @{
  4. "Accept"="application/json, text/javascript, */*; q=0.01"
  5.   "X-Requested-With"="XMLHttpRequest"
  6.   "User-Agent"="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36 Edg/83.0.478.37"
  7.   "Origin"="http://www.musictool.top"
  8.   "Referer"="http://www.musictool.top/?name=the%20right%20path&type=qq"
  9.   "Accept-Encoding"="gzip, deflate"
  10.   "Accept-Language"="zh-CN,zh;q=0.9,en;q=0.8,en-US;q=0.7,en-GB;q=0.6"
  11. } `
  12. -ContentType "application/x-www-form-urlencoded; charset=UTF-8" `
  13. -Body "input=the+right+path&filter=name&type=qq&page=1"
复制代码
在powershell里面可以运行,如何把他写成python的代码?
主要是ContentType不懂处理
作者: wujunkai    时间: 2020-5-31 17:52

我自己搞定了
作者: ivor    时间: 2020-5-31 20:00

ContentType  是响应体中的一条字段,不用发送给服务器。
作者: wujunkai    时间: 2020-6-1 22:13

回复 3# ivor


    但是 "application/x-www-form-urlencoded; charset=UTF-8" 要发送




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2