diff options
author | tilly-Q <nattilypigeonfowl@gmail.com> | 2014-04-15 13:35:22 -0400 |
---|---|---|
committer | tilly-Q <nattilypigeonfowl@gmail.com> | 2014-04-21 12:11:11 -0400 |
commit | ecea4847e8259125dec4617c6f11c7d7e3962925 (patch) | |
tree | ae6c27d667adf2cd7ef8ed917b1b6d2b1b9f41ac /mediagoblin/gmg_commands/batchaddmedia.py | |
parent | 18a9c50db6db680070948fd42043ea0a89deaa6f (diff) | |
download | mediagoblin-ecea4847e8259125dec4617c6f11c7d7e3962925.tar.lz mediagoblin-ecea4847e8259125dec4617c6f11c7d7e3962925.tar.xz mediagoblin-ecea4847e8259125dec4617c6f11c7d7e3962925.zip |
Added the 'requests' library as a dependency and switched over to using it to
fetch remote pieces of media in the batchupload script
Diffstat (limited to 'mediagoblin/gmg_commands/batchaddmedia.py')
-rw-r--r-- | mediagoblin/gmg_commands/batchaddmedia.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/mediagoblin/gmg_commands/batchaddmedia.py b/mediagoblin/gmg_commands/batchaddmedia.py index b058a47e..deb6c5bd 100644 --- a/mediagoblin/gmg_commands/batchaddmedia.py +++ b/mediagoblin/gmg_commands/batchaddmedia.py @@ -15,9 +15,10 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import os -import tempfile, urllib, tarfile, zipfile, subprocess +import tempfile, tarfile, zipfile, subprocess, requests from csv import reader as csv_reader from urlparse import urlparse +import requests from pyld import jsonld from mediagoblin.gmg_commands import util as commands_util @@ -151,10 +152,8 @@ zip files and directories" filename = url.path.split()[-1] if url.scheme == 'http': - media_file = tempfile.TemporaryFile() - res = urllib.urlopen(url.geturl()) - media_file.write(res.read()) - media_file.seek(0) + res = requests.get(url.geturl()) + media_file = res.raw elif url.scheme == '': path = url.path |