original_docstring: 
      Use HTTP multi-part POST to save a file to a SHOCK instance.
      
docstring: Use HTTP multi-part POST to save a file to a SHOCK instance.
docstring_tokens: Use HTTP multi - part POST to save a file to a SHOCK instance .
code: def upload_file_to_shock(logger,
                           shock_service_url = None,
                           filePath = None,
                           attributes = '{}',
                           ssl_verify = True,
                           token = None):
      """
      Use HTTP multi-part POST to save a file to a SHOCK instance.
      """
  
      if token is None:
          raise Exception("Authentication token required!")
      
      #build the header
      header = dict()
      header["Authorization"] = "Oauth {0}".format(token)
  
      if filePath is None:
          raise Exception("No file given for upload to SHOCK!")
  
      dataFile = open(os.path.abspath(filePath), 'r')
      m = MultipartEncoder(fields={'attributes_str': json.dumps(attributes), 'upload': (os.path.split(filePath)[-1], dataFile)})
      header['Content-Type'] = m.content_type
  
      logger.info("Sending {0} to {1}".format(filePath,shock_service_url))
      try:
          response = requests.post(shock_service_url + "/node", headers=header, data=m, allow_redirects=True, verify=ssl_verify)
          dataFile.close()
      except:
          dataFile.close()
          raise    
  
      if not response.ok:
          response.raise_for_status()
  
      result = response.json()
  
      if result['error']:            
          raise Exception(result['error'][0])
      else:
          return result["data"]
code_tokens: def upload_file_to_shock ( logger , shock_service_url = None , filePath = None , attributes = '{}' , ssl_verify = True , token = None ) : if token is None : raise Exception ( "Authentication token required!" ) header = dict ( ) header [ "Authorization" ] = "Oauth {0}" . format ( token ) if filePath is None : raise Exception ( "No file given for upload to SHOCK!" ) dataFile = open ( os . path . abspath ( filePath ) , 'r' ) m = MultipartEncoder ( fields = { 'attributes_str' : json . dumps ( attributes ) , 'upload' : ( os . path . split ( filePath ) [ - 1 ] , dataFile ) } ) header [ 'Content-Type' ] = m . content_type logger . info ( "Sending {0} to {1}" . format ( filePath , shock_service_url ) ) try : response = requests . post ( shock_service_url + "/node" , headers = header , data = m , allow_redirects = True , verify = ssl_verify ) dataFile . close ( ) except : dataFile . close ( ) raise if not response . ok : response . raise_for_status ( ) result = response . json ( ) if result [ 'error' ] : raise Exception ( result [ 'error' ] [ 0 ] ) else : return result [ "data" ]
short_docstring: Use HTTP multi-part POST to save a file to a SHOCK instance.
short_docstring_tokens: Use HTTP multi - part POST to save a file to a SHOCK instance .
comment: """
      Use HTTP multi-part POST to save a file to a SHOCK instance.
      """$SEP$#build the header