문제

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...

도움이 되었습니까?

해결책

From urllib3 docs

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

Use request() instead.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top