如果您在“网络”标签中查看并右键单击网络请求,然后选择“复制->复制为cURL”,则会得到以下内容:
curl 'https://pjd.tjgo.jus.br/BuscaProcessoPublica' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'Accept: application/json,text/javascript,*/*; q=0.01' -H 'Origin: https://pjd.tjgo.jus.br' -H 'X-Requested-With: XMLHttpRequest' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/78.0.3904.97 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-Mode: cors' -H 'Referer: https://pjd.tjgo.jus.br/BuscaProcessoPublica?PaginaAtual=2&Passo=7' -H 'Accept-Encoding: gzip,deflate,br' -H 'Accept-Language: en-US,en;q=0.9' -H 'Cookie: WIDPJP=.cp03-1:cp03-1; style=null; JSESSIONID=kMiu0qC-d11BAdWVd6QoJM837YUXuTsWVgTofjLk.cp03:server-cp03-1' --data 'chamadaAjax=true&tabela=1&offset=0&PassoEditar=12&consultaPronta=true&' --compressed
然后,您可以使用https://curl.trillworks.com/之类的工具,将其从cURL格式转换为请求格式,并以
结尾
cookies = {
'WIDPJP': '.cp03-1:cp03-1','style': 'null','JSESSIONID': 'kMiu0qC-d11BAdWVd6QoJM837YUXuTsWVgTofjLk.cp03:server-cp03-1',}
headers = {
'Connection': 'keep-alive','Pragma': 'no-cache','Cache-Control': 'no-cache','Accept': 'application/json,*/*; q=0.01','Origin': 'https://pjd.tjgo.jus.br','X-Requested-With': 'XMLHttpRequest','User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/78.0.3904.97 Safari/537.36','Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8','Sec-Fetch-Site': 'same-origin','Sec-Fetch-Mode': 'cors','Referer': 'https://pjd.tjgo.jus.br/BuscaProcessoPublica?PaginaAtual=2&Passo=7','Accept-Encoding': 'gzip,br','Accept-Language': 'en-US,en;q=0.9',}
data = {
'chamadaAjax': 'true','tabela': '1','offset': '0','PassoEditar': '12','consultaPronta': 'true','': ''
}
response = requests.post('https://pjd.tjgo.jus.br/BuscaProcessoPublica',headers=headers,cookies=cookies,data=data)
# Edit: If you want to get all the pages of data,you can do something like this:
response = requests.post('https://pjd.tjgo.jus.br/BuscaProcessoPublica',data=data)
TOTAL = response.json()['total']
offset = 0
values = []
while offset < TOTAL:
data['offset'] = str(offset)
response = requests.post('https://pjd.tjgo.jus.br/BuscaProcessoPublica',data=data)
rows = response.json()['rows']
offset += len(rows)
values += rows
本文链接:https://www.f2er.com/3099557.html