Merge pull request #952 from Sworddragon/master

Fixed getting the correct filename
This commit is contained in:
oy 2012-04-21 09:02:33 -07:00
commit d9fe52eea6
2 changed files with 4 additions and 10 deletions

View file

@ -82,11 +82,8 @@ work_dir = root_dir + "scripts/work"
def fetch_file(url):
try:
print("trying %s" % url)
real_url = url_lib.urlopen(url).geturl()
local = real_url.split("/")
local = local[len(local)-1].split("?")
local = local[0]
url_lib.urlretrieve(real_url, local)
local = dict(url_lib.urlopen(url).info())['content-disposition'].split('=')[1]
url_lib.urlretrieve(url, local)
return local
except:
return False

View file

@ -50,11 +50,8 @@ if platform == 'osx':
def fetch_file(url):
try:
print("trying %s" % url)
real_url = url_lib.urlopen(url).geturl()
local = real_url.split("/")
local = local[len(local)-1].split("?")
local = local[0]
url_lib.urlretrieve(real_url, local)
local = dict(url_lib.urlopen(url).info())['content-disposition'].split('=')[1]
url_lib.urlretrieve(url, local)
return local
except:
return False