def getSize(cls, url): if url.scheme.lower() == 'ftp': return None for attempt in retry_http(): with attempt: with closing(urlopen(url.geturl())) as readable: # just read the header for content length return int(readable.info().get('content-length'))
def _readFromUrl(cls, url, writable): for attempt in retry_http(): with attempt: with closing(urllib2.urlopen(url.geturl())) as readable: shutil.copyfileobj(readable, writable)
def _readFromUrl(cls, url, writable): for attempt in retry_http(): with attempt: with closing(urlopen(url.geturl())) as readable: shutil.copyfileobj(readable, writable)
def getSize(cls, url): for attempt in retry_http(): with attempt: with closing(urlopen(url.geturl())) as readable: # just read the header for content length return readable.info().get('content-length')