Ejemplo n.º 1
0
 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'))
Ejemplo n.º 2
0
 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'))
Ejemplo n.º 3
0
 def _readFromUrl(cls, url, writable):
     for attempt in retry_http():
         with attempt:
             with closing(urllib2.urlopen(url.geturl())) as readable:
                 shutil.copyfileobj(readable, writable)
Ejemplo n.º 4
0
 def _readFromUrl(cls, url, writable):
     for attempt in retry_http():
         with attempt:
             with closing(urlopen(url.geturl())) as readable:
                 shutil.copyfileobj(readable, writable)
Ejemplo n.º 5
0
 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')