urlo upload as js function
This commit is contained in:
@@ -5,16 +5,22 @@ try:
|
||||
from urllib.request import pathname2url
|
||||
from urllib.request import URLopener
|
||||
from urllib.request import urlparse
|
||||
from urllib.error import HTTPError
|
||||
except ImportError:
|
||||
from urllib import pathname2url
|
||||
from urllib import URLopener
|
||||
from urlparse import urlparse
|
||||
from urllib2 import HTTPError
|
||||
|
||||
|
||||
def download_url(url,filename):
|
||||
downloader = URLopener()
|
||||
downloader.retrieve(url, filename)
|
||||
return
|
||||
try:
|
||||
downloader.retrieve(url, filename)
|
||||
except HTTPError as e:
|
||||
return (False, ("%s %s"%(e.code,e.reason), e.code))
|
||||
return (True, ("OK", 200 ))
|
||||
|
||||
|
||||
def file_date_human(num):
|
||||
return datetime.fromtimestamp(
|
||||
|
||||
Reference in New Issue
Block a user