def talk_to_agent(address, method, data=None):
  try:
    url = 'https://{0}:{1}{2}'.format(address, cfg.port, method)
    # The coordinator's certificate is self-signed, so we cannot verify we are
    # talking to the "correct" coordinator. Eavesdropping is not a problem, but
    # man-in-the-middle attacks could be.
    http = httplib2.Http(disable_ssl_certificate_validation=True, timeout=5)
    if data is None:
      # GET
      return json.loads(http.request(url, 'GET')[1])
    else:
      # POST
      return json.loads(http.request(url, 'POST', urllib.urlencode(data))[1])
  except (httplib2.HttpLib2Error, socket.error, ValueError):
    return None
Make a REST call. These are described in docs/API.
dataset/ETHPy150Open GoogleCloudPlatform/compute-hadoop-java-python/util.py/talk_to_agent