original_docstring: 
      Given a SHOCK instance URL and a SHOCK node id, download the contents of that node
      to a file on disk.
      
docstring: Given a SHOCK instance URL and a SHOCK node id, download the contents of that node
  to a file on disk.
docstring_tokens: Given a SHOCK instance URL and a SHOCK node id download the contents of that node to a file on disk .
code: def download_file_from_shock(logger,
                               shock_service_url = None,
                               shock_id = None,
                               filename = None,
                               directory = None,
                               token = None):
      """
      Given a SHOCK instance URL and a SHOCK node id, download the contents of that node
      to a file on disk.
      """
  
      header = dict()
      header["Authorization"] = "Oauth {0}".format(token)
  
      logger.info("Downloading shock node {0}/node/{1}".format(shock_service_url,shock_id))
  
      metadata_response = requests.get("{0}/node/{1}?verbosity=metadata".format(shock_service_url, shock_id), headers=header, stream=True, verify=True)
      shock_metadata = metadata_response.json()['data']
      shockFileName = shock_metadata['file']['name']
      shockFileSize = shock_metadata['file']['size']
      metadata_response.close()
          
      download_url = "{0}/node/{1}?download_raw".format(shock_service_url, shock_id)
          
      data = requests.get(download_url, headers=header, stream=True, verify=True)
  
      if filename is not None:
          shockFileName = filename
  
      if directory is not None:
          filePath = os.path.join(directory, shockFileName)
      else:
          filePath = shockFileName
  
      chunkSize = shockFileSize/4
      
      maxChunkSize = 2**30
      
      if chunkSize > maxChunkSize:
          chunkSize = maxChunkSize
      
      f = io.open(filePath, 'wb')
      try:
          for chunk in data.iter_content(chunkSize):
              f.write(chunk)
      finally:
          data.close()
          f.close()
code_tokens: def download_file_from_shock ( logger , shock_service_url = None , shock_id = None , filename = None , directory = None , token = None ) : header = dict ( ) header [ "Authorization" ] = "Oauth {0}" . format ( token ) logger . info ( "Downloading shock node {0}/node/{1}" . format ( shock_service_url , shock_id ) ) metadata_response = requests . get ( "{0}/node/{1}?verbosity=metadata" . format ( shock_service_url , shock_id ) , headers = header , stream = True , verify = True ) shock_metadata = metadata_response . json ( ) [ 'data' ] shockFileName = shock_metadata [ 'file' ] [ 'name' ] shockFileSize = shock_metadata [ 'file' ] [ 'size' ] metadata_response . close ( ) download_url = "{0}/node/{1}?download_raw" . format ( shock_service_url , shock_id ) data = requests . get ( download_url , headers = header , stream = True , verify = True ) if filename is not None : shockFileName = filename if directory is not None : filePath = os . path . join ( directory , shockFileName ) else : filePath = shockFileName chunkSize = shockFileSize / 4 maxChunkSize = 2 ** 30 if chunkSize > maxChunkSize : chunkSize = maxChunkSize f = io . open ( filePath , 'wb' ) try : for chunk in data . iter_content ( chunkSize ) : f . write ( chunk ) finally : data . close ( ) f . close ( )
short_docstring: Given a SHOCK instance URL and a SHOCK node id, download the contents of that node
  to a file on disk.
short_docstring_tokens: Given a SHOCK instance URL and a SHOCK node id download the contents of that node to a file on disk .
comment: """
      Given a SHOCK instance URL and a SHOCK node id, download the contents of that node
      to a file on disk.
      """