Added the 'requests' library as a dependency and switched over to using it to
fetch remote pieces of media in the batchupload script
This commit is contained in:
parent
18a9c50db6
commit
ecea4847e8
@ -15,9 +15,10 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import tempfile, urllib, tarfile, zipfile, subprocess
|
import tempfile, tarfile, zipfile, subprocess, requests
|
||||||
from csv import reader as csv_reader
|
from csv import reader as csv_reader
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
import requests
|
||||||
from pyld import jsonld
|
from pyld import jsonld
|
||||||
|
|
||||||
from mediagoblin.gmg_commands import util as commands_util
|
from mediagoblin.gmg_commands import util as commands_util
|
||||||
@ -151,10 +152,8 @@ zip files and directories"
|
|||||||
filename = url.path.split()[-1]
|
filename = url.path.split()[-1]
|
||||||
|
|
||||||
if url.scheme == 'http':
|
if url.scheme == 'http':
|
||||||
media_file = tempfile.TemporaryFile()
|
res = requests.get(url.geturl())
|
||||||
res = urllib.urlopen(url.geturl())
|
media_file = res.raw
|
||||||
media_file.write(res.read())
|
|
||||||
media_file.seek(0)
|
|
||||||
|
|
||||||
elif url.scheme == '':
|
elif url.scheme == '':
|
||||||
path = url.path
|
path = url.path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user