use either urllib2 or urllib.request as necessary
This commit is contained in:
parent
8d512d7e07
commit
fad10e5a98
@ -1,5 +1,10 @@
|
|||||||
import os
|
import os
|
||||||
import urllib2
|
|
||||||
|
try:
|
||||||
|
from urllib.request import urlopen # attemp py3 first
|
||||||
|
except ImportError:
|
||||||
|
from urllib2 import urlopen # fallback to py2
|
||||||
|
|
||||||
"""
|
"""
|
||||||
General utilities used within saucebrush that may be useful elsewhere.
|
General utilities used within saucebrush that may be useful elsewhere.
|
||||||
"""
|
"""
|
||||||
@ -112,7 +117,7 @@ class RemoteFile(object):
|
|||||||
self._url = url
|
self._url = url
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
resp = urllib2.urlopen(self._url)
|
resp = urlopen(self._url)
|
||||||
for line in resp:
|
for line in resp:
|
||||||
yield line.rstrip()
|
yield line.rstrip()
|
||||||
resp.close()
|
resp.close()
|
Loading…
Reference in New Issue
Block a user