예제 #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'))
예제 #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'))
예제 #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)
예제 #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)
예제 #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')