Show More
@@ -516,10 +516,8 b' class DisplayObject(object):' | |||||
516 | self.data = f.read() |
|
516 | self.data = f.read() | |
517 | elif self.url is not None: |
|
517 | elif self.url is not None: | |
518 | try: |
|
518 | try: | |
519 |
|
|
519 | # Deferred import | |
520 |
|
|
520 | from urllib.request import urlopen | |
521 | except ImportError: |
|
|||
522 | from urllib2 import urlopen |
|
|||
523 | response = urlopen(self.url) |
|
521 | response = urlopen(self.url) | |
524 | self.data = response.read() |
|
522 | self.data = response.read() | |
525 | # extract encoding from header, if there is one: |
|
523 | # extract encoding from header, if there is one: |
@@ -155,12 +155,8 b' class ExtensionManager(Configurable):' | |||||
155 | copy = copyfile |
|
155 | copy = copyfile | |
156 | else: |
|
156 | else: | |
157 | # Deferred imports |
|
157 | # Deferred imports | |
158 | try: |
|
158 | from urllib.parse import urlparse | |
159 | from urllib.parse import urlparse # Py3 |
|
|||
160 |
|
|
159 | from urllib.request import urlretrieve | |
161 | except ImportError: |
|
|||
162 | from urlparse import urlparse |
|
|||
163 | from urllib import urlretrieve |
|
|||
164 | src_filename = urlparse(url).path.split('/')[-1] |
|
160 | src_filename = urlparse(url).path.split('/')[-1] | |
165 | copy = urlretrieve |
|
161 | copy = urlretrieve | |
166 |
|
162 |
@@ -3124,10 +3124,7 b' class InteractiveShell(SingletonConfigurable):' | |||||
3124 | except UnicodeDecodeError: |
|
3124 | except UnicodeDecodeError: | |
3125 | if not py_only : |
|
3125 | if not py_only : | |
3126 | # Deferred import |
|
3126 | # Deferred import | |
3127 | try: |
|
3127 | from urllib.request import urlopen | |
3128 | from urllib.request import urlopen # Py3 |
|
|||
3129 | except ImportError: |
|
|||
3130 | from urllib import urlopen |
|
|||
3131 | response = urlopen(target) |
|
3128 | response = urlopen(target) | |
3132 | return response.read().decode('latin1') |
|
3129 | return response.read().decode('latin1') | |
3133 | raise ValueError(("'%s' seem to be unreadable.") % target) |
|
3130 | raise ValueError(("'%s' seem to be unreadable.") % target) |
@@ -263,10 +263,9 b' class YouTubeVideo(IFrame):' | |||||
263 | super(YouTubeVideo, self).__init__(src, width, height, **kwargs) |
|
263 | super(YouTubeVideo, self).__init__(src, width, height, **kwargs) | |
264 |
|
264 | |||
265 | def _repr_jpeg_(self): |
|
265 | def _repr_jpeg_(self): | |
266 | try: |
|
266 | # Deferred import | |
267 |
|
|
267 | from urllib.request import urlopen | |
268 | except ImportError: |
|
268 | ||
269 | from urllib2 import urlopen |
|
|||
270 | try: |
|
269 | try: | |
271 | return urlopen("https://img.youtube.com/vi/{id}/hqdefault.jpg".format(id=self.id)).read() |
|
270 | return urlopen("https://img.youtube.com/vi/{id}/hqdefault.jpg".format(id=self.id)).read() | |
272 | except IOError: |
|
271 | except IOError: |
General Comments 0
You need to be logged in to leave comments.
Login now