[英]Python: What's wrong with this Python Code(requests)?
import requests
# import sys
# sys.setdefaultencoding('utf-8')
def get_book():
#http://search.dangdang.com/?key=c%D3%EF%D1%D4&act=input
url="http://search.dangdang.com/"
rest=requests.get(url,parms={
'key':'c%D3%EF%D1%D4',
# "enc":"utf-8",
# "wq":"haixian",
'act':'input'
})
rest = requests.get(url)
print(rest.text)
# rest.json()
# rest.content
#requests.post()
if __name__=="__main__":
get_book()
Process finished with exit code 1 TypeError: request() got an unexpected keyword argument 'parms' It cannot work.进程已完成,退出代码 1 TypeError: request() got an unexpected keyword argument 'parms' 它无法工作。 What's the problem with this code, and how can I fix it?
这段代码有什么问题,我该如何解决?
Use params
instead of parms
使用
params
而不是parms
import requests
# import sys
# sys.setdefaultencoding('utf-8')
def get_book():
#http://search.dangdang.com/?key=c%D3%EF%D1%D4&act=input
url="http://search.dangdang.com/"
rest=requests.get(url,params={
'key':'c%D3%EF%D1%D4',
# "enc":"utf-8",
# "wq":"haixian",
'act':'input'
})
rest = requests.get(url)
print(rest.text)
# rest.json()
# rest.content
#requests.post()
if __name__=="__main__":
get_book()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.