tools/traffic_annotation/scripts/generator_utils.py
def extract_body(document=None, target="body", json_file_path="template.json"):
  """Google Doc API returns a .json object. Parse this doc object to obtain its
  body.

  The |template.json| object of the current state of
  the document can be obtained by running the update_annotations_doc.py script
  using the --debug flag.
  """
  if document:
    doc = document
  else:
    try:
      with open(json_file_path) as json_file:
        doc = json.load(json_file)
    except IOError:
      print("Couldn't find the .json file.")

  if target == "all":
    return doc
  return doc[target]
Google Doc API returns a .json object. Parse this doc object to obtain its
  body.

  The |template.json| object of the current state of
  the document can be obtained by running the update_annotations_doc.py script
  using the --debug flag.
  
Google Doc API returns a .json object. Parse this doc object to obtain its
body.

The |template.json| object of the current state of
the document can be obtained by running the update_annotations_doc.py script
using the --debug flag.
Google Doc API returns a . json object . Parse this doc object to obtain its body . The |template . json| object of the current state of the document can be obtained by running the update_annotations_doc . py script using the -- debug flag .
def extract_body(document=None, target="body", json_file_path="template.json"):
  if document:
    doc = document
  else:
    try:
      with open(json_file_path) as json_file:
        doc = json.load(json_file)
    except IOError:
      print("Couldn't find the .json file.")
  if target == "all":
    return doc
  return doc[target]
def extract_body ( document = None , target = "body" , json_file_path = "template.json" ) : if document : doc = document else : try : with open ( json_file_path ) as json_file : doc = json . load ( json_file ) except IOError : print ( "Couldn't find the .json file." ) if target == "all" : return doc return doc [ target ]
Google Doc API returns a .json object.
Google Doc API returns a . json object .
"""Google Doc API returns a .json object. Parse this doc object to obtain its
  body.

  The |template.json| object of the current state of
  the document can be obtained by running the update_annotations_doc.py script
  using the --debug flag.
  """
document
target
json_file_path