0

这是我的代码:

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'

我谷歌它,但没有什么相关的。太奇怪了,我想不通...

4

1 回答 1

2

urllib3 docs

get_url(url, fields=None, **urlopen_kw)
Deprecated since version 1.0.

Use request() instead.
于 2012-05-28T08:25:26.310 回答