qq_50617823
qq_50617823
采纳率50%
2020-09-10 13:15

python错误TypeError: request() got an unexpected keyword argument 'date'

已采纳

程序
import requests
if name=='__main__':
url='http://www.kfc.com.cn/kfccda/ashx/GetStoreList.ashx?op=keyword'
date={
'cname':'',
'pid':'',
'keyword': '北京',
'pageIndex': '1',
'pageSize': '10'
}
header={
'User - Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36 Edg/85.0.564.44'
}
respons=requests.post(url=url,date=date,headers=header)
print(respons.text)
错误
Traceback (most recent call last):
File "C:/Users/86151/PycharmProjects/untitled/venv/08.py", line 14, in
respons=requests.post(url=url,date=date,headers=header)
File "C:\Users\86151\PycharmProjects\untitled\venv\lib\site-packages\requests\api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "C:\Users\86151\PycharmProjects\untitled\venv\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
TypeError: request() got an unexpected keyword argument 'date'

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • caozhy 从今以后生命中的每一秒都属于我爱的人 8月前

    TypeError: request() got an unexpected keyword argument 'date'
    应该是data=date

    点赞 3 评论 复制链接分享
  • jingluan666 jingluan666 8月前

    date=date,应该是data=data,date是日期的意思,data是数据

    点赞 1 评论 复制链接分享

相关推荐