我正在尝试使用其api从网站https://seminovos.unidas.com.br/收集一些数据。但是,我的代码返回了如下错误:
ValueError: too many values to unpack (expected 2)
你们能帮我吗?
这里跟随代码:
import pandas as pd
import requests as rq
import warnings
from datetime import date
warnings.filterwarnings('ignore')
from email.mime.text import MIMEText
import smtplib, ssl
import win32com.client as win32
session = rq.Session()
headers = {'Accept': 'application/json, text/plain, */*',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7',
'Connection': 'keep-alive',
'Content-Length': '425',
'Content-Type': 'application/json;charset=UTF-8',
'Cookie': 'XSRF-TOKEN=eyJpdiI6InR6aWFkdmt0TkN1cmljcXFnSzhjWlE9PSIsInZhbHVlIjoiTjQzQWpBUENDQ2JVT3JzbDI5MStKNURCOGJMTUs0K3dkOWpRRTJuOHY2NFd5ODlOYk4yMTZuenhaTktBZ29TNyIsIm1hYyI6ImI3NjQzNjE4NjliZTM3NzdlYjI4ZDYxMDA5NTgxODY1MWEzODE4ZDYwZDRkNjMzYzg4NzcxZDEzNjA5ZWM2ZTIifQ%3D%3D; unidas_session=eyJpdiI6IkZVK0p5ZG0wcHI1VEFZWGtBeVdkcnc9PSIsInZhbHVlIjoiekFlQjNOSmxcL1ZDeHdGVHlMbGpXYjZ3RG1aQ0k0NjRLMXpFTG5hRTJZbTlWemo0MkhDUEhCV1djMlBvSWtsMHAiLCJtYWMiOiJkYzZlMGIxMzIzMmI0MzY3YjFiZmJlNWUxNzc2ZGNmZTFlOGYzNmJiNzYyY2Q4YjgzMTBmYTY1NTM2MGIyMDhhIn0%3D',
'dnt': '1',
'Host': 'seminovos.unidas.com.br',
'Origin': 'https://seminovos.unidas.com.br',
'Referer': 'https://seminovos.unidas.com.br/veiculos',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Mobile Safari/537.36',
'X-XSRF-TOKEN': 'eyJpdiI6InR6aWFkdmt0TkN1cmljcXFnSzhjWlE9PSIsInZhbHVlIjoiTjQzQWpBUENDQ2JVT3JzbDI5MStKNURCOGJMTUs0K3dkOWpRRTJuOHY2NFd5ODlOYk4yMTZuenhaTktBZ29TNyIsIm1hYyI6ImI3NjQzNjE4NjliZTM3NzdlYjI4ZDYxMDA5NTgxODY1MWEzODE4ZDYwZDRkNjMzYzg4NzcxZDEzNjA5ZWM2ZTIifQ==',
}
params = (('page','1'))
response = session.post('https://seminovos.unidas.com.br//json/veiculos.json?page=1',headers=headers,params = params, verify = False)
将参数设为字典,例如params = {"page": 1}
。