首页上一页 1 下一页尾页 1 条记录 1/1页
书上的发送post请求,为什么不行
发表在Python图书答疑
2020-12-30
《Python网络爬虫从入门到实践》第3章 请求模块urllib 47页-48页
是否精华
是
否
版块置顶:
是
否
那个发送post请求那里,我照着书上的打的,运行报错,然后下载书上的配套代码运行也报错(在pycharm运行)
Traceback (most recent call last):
File "O:\爬虫代码\发送get请求.py", line 8, in
data = bytes(urllib.request.urlopen({'hello python'}),encoding='utf-8')
File "O:\python\lib\urllib\request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "O:\python\lib\urllib\request.py", line 507, in open
req.timeout = timeout
AttributeError: 'set' object has no attribute 'timeout'
Traceback (most recent call last):
File "O:\爬虫代码\发送get请求.py", line 8, in
data = bytes(urllib.request.urlopen({'hello python'}),encoding='utf-8')
File "O:\python\lib\urllib\request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "O:\python\lib\urllib\request.py", line 507, in open
req.timeout = timeout
AttributeError: 'set' object has no attribute 'timeout'
于2020-12-30 10:38:19编辑