parameters: (self, num_retries=0)
docstring: Get the next chunk of the download.
  
      Args:
        num_retries: Integer, number of times to retry 500's with randomized
              exponential backoff. If all retries fail, the raised HttpError
              represents the last request. If zero (default), we attempt the
              request only once.
  
      Returns:
        (status, done): (MediaDownloadStatus, boolean)
           The value of 'done' will be True when the media has been fully
           downloaded.
  
      Raises:
        googleapiclient.errors.HttpError if the response was not a 2xx.
        httplib2.HttpLib2Error if a transport error has occured.
docstring_summary: Get the next chunk of the download.
docstring_tokens: Get the next chunk of the download .
function: def next_chunk(self, num_retries=0):
      """Get the next chunk of the download.
  
      Args:
        num_retries: Integer, number of times to retry 500's with randomized
              exponential backoff. If all retries fail, the raised HttpError
              represents the last request. If zero (default), we attempt the
              request only once.
  
      Returns:
        (status, done): (MediaDownloadStatus, boolean)
           The value of 'done' will be True when the media has been fully
           downloaded.
  
      Raises:
        googleapiclient.errors.HttpError if the response was not a 2xx.
        httplib2.HttpLib2Error if a transport error has occured.
      """
      headers = {
          'range': 'bytes=%d-%d' % (
              self._progress, self._progress + self._chunksize)
          }
      http = self._request.http
  
      for retry_num in range(num_retries + 1):
        if retry_num > 0:
          self._sleep(self._rand() * 2**retry_num)
          logging.warning(
              'Retry #%d for media download: GET %s, following status: %d'
              % (retry_num, self._uri, resp.status))
  
        resp, content = http.request(self._uri, headers=headers)
        if resp.status < 500:
          break
  
      if resp.status in [200, 206]:
        if 'content-location' in resp and resp['content-location'] != self._uri:
          self._uri = resp['content-location']
        self._progress += len(content)
        self._fd.write(content)
  
        if 'content-range' in resp:
          content_range = resp['content-range']
          length = content_range.rsplit('/', 1)[1]
          self._total_size = int(length)
        elif 'content-length' in resp:
          self._total_size = int(resp['content-length'])
  
        if self._progress == self._total_size:
          self._done = True
        return MediaDownloadProgress(self._progress, self._total_size), self._done
      else:
        raise HttpError(resp, content, uri=self._uri)
function_tokens: def next_chunk ( self , num_retries = 0 ) : headers = { 'range' : 'bytes=%d-%d' % ( self . _progress , self . _progress + self . _chunksize ) } http = self . _request . http for retry_num in range ( num_retries + 1 ) : if retry_num > 0 : self . _sleep ( self . _rand ( ) * 2 ** retry_num ) logging . warning ( 'Retry #%d for media download: GET %s, following status: %d' % ( retry_num , self . _uri , resp . status ) ) resp , content = http . request ( self . _uri , headers = headers ) if resp . status < 500 : break if resp . status in [ 200 , 206 ] : if 'content-location' in resp and resp [ 'content-location' ] != self . _uri : self . _uri = resp [ 'content-location' ] self . _progress += len ( content ) self . _fd . write ( content ) if 'content-range' in resp : content_range = resp [ 'content-range' ] length = content_range . rsplit ( '/' , 1 ) [ 1 ] self . _total_size = int ( length ) elif 'content-length' in resp : self . _total_size = int ( resp [ 'content-length' ] ) if self . _progress == self . _total_size : self . _done = True return MediaDownloadProgress ( self . _progress , self . _total_size ) , self . _done else : raise HttpError ( resp , content , uri = self . _uri )