这是我的代码:
import urllib3
url='http://www.google.com/'
http_pool = urllib3.connection_from_url(url)
content = http_pool.get_url('/')
print (content.info())
print ('----------------------------')
page = content.read()
print (page)
错误:
Traceback (most recent call last):
File "C:\python\test.py", line 24, in <module>
content = http_pool.get_url('/')
AttributeError: 'HTTPConnectionPool' object has no attribute 'get_url'
我贬低它,但没有任何相关性。 这太奇怪了,我无法弄清楚......
答案 0 :(得分:2)
get_url(url, fields=None, **urlopen_kw)
Deprecated since version 1.0.
Use request() instead.