Question

this is my codes:

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)

error:

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'

I goolge it ,but nothing relevant. It's so strange that i can't figure out...

Was it helpful?

Solution

From urllib3 docs

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

Use request() instead.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top