我不知道如何使用以下数据正确设置POST请求:
General
Request URL: https://myurl.com/install/index.cgi
Request Method: POST
Request Headers
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en
Cache-Control: max-age=0
Connection: keep-alive
Content-Length: 48
Content-Type: application/x-www-form-urlencoded
Host: myurl.com
Origin: https://myurl.com
Referer: https://myurl.com/install/
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Form Data
page: install
state: STATUS
我可以执行以下操作:
import requests
headers = {"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Encoding":"gzip,deflate,br",
"Accept-Language":"en-US,en;q=0.8",
"Cache-Control":"max-age=0",
"Connection":"keep-alive",
"Content-Length":"48",
"Content-Type":"application/x-www-form-urlencoded",
"Host":"myurl.com",
"Origin":"https://myurl.com",
"Referer":"https://myurl.com/install/?s=ROM",
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"}
f = requests.put(path, headers=headers)
但是如何处理表单数据?在表单数据下有一个页面:install和状态:STATUS。
如何在我的POST请求中包括此内容?
答案 0 :(得分:1)
仅add Sub createRanges()
Dim LastRowAll As Long, LastRowUnique As Long
Dim x, y
Dim rng As Range
Dim rng_name As String
LastRowUnique = Sheets("Lists").Range("J2").End(xlDown).Row
LastRowAll = Sheets("Deribit").Range("D8").End(xlDown).Row
For Each x In Sheets("Lists").Range("J2:J" & LastRowUnique)
For Each y In Sheets("Deribit").Range("D8:D" & LastRowAll)
If y.Offset(0, -1).value = "Call" Then
If rng Is Nothing And y = x Then
Set rng = y.Offset(0, -2)
ElseIf y = x Then
Set rng = Union(rng, y.Offset(0, -2))
End If
Else:
End If
Next y
rng_name = "C_" & x.Offset(0, -1).value
ThisWorkbook.Names.Add Name:=rng_name, RefersTo:=rng.Address
Set rng = Nothing
Next x
到您的请求:
data=
答案 1 :(得分:-1)
我想您知道如何在您选择的浏览器上使用开发工具。
以下是我遵循的模板:
< / p>
加载页面(GET)
使用XPATH查找我要定位的find_element_by_id,即用户名
将XPATH设置为此类元素的SetValue
发布页面(POST)