def GenDiscoveryDoc(service_class_names, doc_format,
                    output_path, hostname=None):
  output_files = []
  service_configs = GenApiConfig(service_class_names, hostname=hostname)
  for service_class_name, config in service_configs.iteritems():
    body = json.dumps({'config': config}, indent=2, sort_keys=True)
    request = urllib2.Request(DISCOVERY_DOC_BASE + doc_format, body)
    request.add_header('content-type', 'application/json')

    try:
      with contextlib.closing(urllib2.urlopen(request)) as response:
        content = response.read()
        _, base_service_class_name = service_class_name.rsplit('.', 1)
        discovery_name = base_service_class_name + '.discovery'
        output_files.append(_WriteFile(output_path, discovery_name, content))
    except urllib2.HTTPError, error:
      raise ServerRequestException(error)

  return output_files
Retrieve invitation and create account
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/endpointscfg.py/GenDiscoveryDoc--crossover with--dataset/ETHPy150Open treeio/treeio/treeio/core/views.py/invitation_retrieve