def upload_timeline(self, timeline_name, plaso_storage_path):
    """Create a timeline with the specified name from the given plaso file.

    Args:
      timeline_name (str): Name of timeline
      plaso_storage_path (str): Local path of plaso file to be uploaded

    Returns:
      int: ID of uploaded timeline

    Raises:
      RuntimeError: When the JSON response from Timesketch cannot be decoded.
    """
    resource_url = '{0:s}/upload/'.format(self.api_base_url)
    files = {'file': open(plaso_storage_path, 'rb')}
    data = {'name': timeline_name}
    response = self.session.post(resource_url, files=files, data=data)
    try:
      response_dict = response.json()
    except ValueError:
      raise RuntimeError(
          'Could not decode JSON response from Timesketch'
          ' (Status {0:d}):\n{1:s}'.format(
              response.status_code, response.content))

    index_id = response_dict['objects'][0]['id']
    return index_id
def upload_timeline ( self , timeline_name , plaso_storage_path ) : resource_url = '{0:s}/upload/' . format ( self . api_base_url ) files = { 'file' : open ( plaso_storage_path , 'rb' ) } data = { 'name' : timeline_name } response = self . session . post ( resource_url , files = files , data = data ) try : response_dict = response . json ( ) except ValueError : raise RuntimeError ( 'Could not decode JSON response from Timesketch' ' (Status {0:d}):\n{1:s}' . format ( response . status_code , response . content ) ) index_id = response_dict [ 'objects' ] [ 0 ] [ 'id' ] return index_id
Create a timeline with the specified name from the given plaso file.

    Args:
      timeline_name (str): Name of timeline
      plaso_storage_path (str): Local path of plaso file to be uploaded

    Returns:
      int: ID of uploaded timeline

    Raises:
      RuntimeError: When the JSON response from Timesketch cannot be decoded.