Open
Description
This works fine:
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib2 import urlopen
>>> urlopen('https://google.ca')
<addinfourl at 140299620351008 whose fp = <socket._fileobject object at 0x7f9a0f352050>>
>>> _.read()[:100]
'<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en-CA"><head><meta cont'
Great! But then this fails:
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import future.standard_library
>>> future.standard_library.install_aliases()
>>> from urllib.request import urlopen
>>> urlopen('https://google.ca')
(…)
future.backports.urllib.error.URLError: <urlopen error unknown url type: https>
>>> future.__version__
'0.15.2'
But 3 is fine too:
Python 3.4.0 (default, Jun 19 2015, 14:20:21)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib.request import urlopen
>>> urlopen('https://google.ca')
<http.client.HTTPResponse object at 0x7f5cdbb295c0>
>>> _.read()[:100]
b'<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en-CA"><head><meta cont'
What's going on?