Module Expr Str ImportFrom alias Import alias TryExcept body Import alias handlers ExceptHandler type NameLoad body Import alias identifier Import alias Import alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias Assign NameStore Str Assign NameStore Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore NameLoad If AttributeLoad NameLoad attr body TryExcept body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore ListComp BinOpMod Str TupleLoad SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str comprehension NameStore SubscriptLoad SubscriptLoad NameLoad Index Str Index Str handlers ExceptHandler type TupleLoad NameLoad NameLoad NameLoad body Pass If NameLoad body Assign NameStore BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad orelse Assign NameStore BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad With Call NameLoad NameLoad Str NameStore body Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign NameStore Dict Assign NameStore BoolOpOr NameLoad Call AttributeLoad NameLoad attr For NameStore NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Str Num Assign NameStore Call NameLoad NameLoad keyword NameLoad Assign NameStore Call NameLoad NameLoad NameLoad If UnaryOpNot BoolOpAnd Call NameLoad NameLoad NameLoad Call NameLoad NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad BinOpMod Str NameLoad Assign NameStore BoolOpOr AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign SubscriptStore NameLoad Index NameLoad Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore ListLoad Assign NameStore Call NameLoad NameLoad keyword NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr Dict Str NameLoad keyword Num keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpAdd NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Str Str TryExcept body With Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameStore body Assign NameStore Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Str Num Assign NameStore BinOpAdd NameLoad Str Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad NameLoad handlers ExceptHandler type AttributeLoad NameLoad attr name NameStore body Raise Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str With Call NameLoad NameLoad NameStore body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Str Str Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Dict Str Str NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad TryExcept body With Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameStore body Assign NameStore Call AttributeLoad NameLoad attr Return Call NameLoad NameLoad NameLoad NameLoad handlers ExceptHandler type AttributeLoad NameLoad attr name NameStore body Raise Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call NameLoad NameLoad NameLoad NameLoad keyword NameLoad Assign NameStore ListLoad For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign TupleStore NameStore NameStore NameStore TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad keyword NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Str Num Assign NameStore BinOpAdd NameLoad Str Expr Call NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign TupleStore NameStore NameStore NameStore NameStore NameStore TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad keyword NameLoad For NameStore NameLoad body Print BinOpMod Str NameLoad For NameStore NameLoad body Print BinOpMod Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign TupleStore NameStore NameStore NameStore NameStore TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad NameLoad NameLoad keyword NameLoad For NameStore NameLoad body Print BinOpMod Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign TupleStore NameStore NameStore NameStore TupleLoad SubscriptLoad AttributeLoad NameLoad attr Index Num AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad NameLoad NameLoad Print BinOpMod Str NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Import alias FunctionDef arguments args NameParam defaults vararg body Expr Str If CompareIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str If CompareIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword ListLoad Str Str keyword Str If CompareIn Str NameLoad body Assign NameStore Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad If CompareIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str If CompareIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Str keyword ListLoad Str keyword Str If CompareIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str If CompareIn Str NameLoad body Expr Call AttributeLoad NameLoad attr Str keyword Num keyword Str decorator_list Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr keyword Str Assign NameStore Call AttributeLoad NameLoad attr Str keyword Str Expr Call AttributeLoad NameLoad attr keyword NameLoad Expr Call NameLoad NameLoad Str Str Str Str Str Str Assign NameStore Call AttributeLoad NameLoad attr Str keyword Str Expr Call AttributeLoad NameLoad attr keyword NameLoad Expr Call NameLoad NameLoad Str Str Str Str Assign NameStore Call AttributeLoad NameLoad attr Str keyword Str Expr Call AttributeLoad NameLoad attr keyword NameLoad Expr Call NameLoad NameLoad Str Str Str Str Str Assign NameStore Call AttributeLoad NameLoad attr Str keyword Str Expr Call AttributeLoad NameLoad attr keyword NameLoad Expr Call NameLoad NameLoad Str Str Str Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Num Assign NameStore Call NameLoad NameLoad Str NameLoad If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return Num decorator_list If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr
N/A N/A External script for generating Cloud Endpoints related files.

The gen_discovery_doc subcommand takes a list of fully qualified ProtoRPC
service names and calls a cloud service which generates a discovery document in
REST or RPC style.

Example:
  endpointscfg.py gen_discovery_doc -o . -f rest postservice.GreetingsV1

The gen_client_lib subcommand takes a discovery document and calls a cloud
service to generate a client library for a target language (currently just Java)

Example:
  endpointscfg.py gen_client_lib java -o . greetings-v0.1-rest.api

The get_client_lib subcommand does both of the above commands at once.

Example:
  endpointscfg.py get_client_lib java -o . -f rest postservice.GreetingsV1

The gen_api_config command outputs an .api configuration file for a service.

Example:
  endpointscfg.py gen_api_config -o . -a /path/to/app     --hostname myhost.appspot.com postservice.GreetingsV1
 __future__ with_statement N/A contextlib N/A N/A N/A json N/A N/A N/A ImportError N/A N/A simplejson json N/A os N/A re N/A sys N/A urllib N/A urllib2 protorpc remote google.appengine.ext.endpoints api_config N/A DISCOVERY_DOC_BASE https://webapis-discovery.appspot.com/_ah/api/discovery/v1/apis/generate/ N/A CLIENT_LIBRARY_BASE https://google-api-client-libraries.appspot.com/generate ServerRequestException N/A Exception N/A N/A Exception for problems with the request to a server. __init__ N/A N/A self http_error N/A N/A N/A Create a ServerRequestException from a given urllib2.HTTPError.

    Args:
      http_error: The HTTPError that the ServerRequestException will be
        based on.
     N/A error_details None N/A N/A http_error fp N/A N/A N/A N/A error_body N/A N/A json load N/A http_error fp N/A error_details N/A N/A %s: %s N/A N/A detail N/A message N/A detail N/A debug_info N/A detail N/A N/A error_body N/A error N/A errors N/A N/A N/A N/A ValueError TypeError KeyError N/A N/A N/A error_details N/A N/A error_message N/A HTTP %s (%s) error when communicating with URL: %s.  Details: %s N/A N/A http_error code N/A http_error reason N/A http_error filename error_details N/A N/A error_message N/A HTTP %s (%s) error when communicating with URL: %s. N/A N/A http_error code N/A http_error reason N/A http_error filename N/A N/A N/A N/A super ServerRequestException self __init__ error_message N/A N/A _WriteFile N/A N/A output_path name content N/A N/A N/A Write given content to a file in a given directory.

  Args:
    output_path: The directory to store the file in.
    name: The name of the file to store the content in.
    content: The content to write to the file.close

  Returns:
    The full path to the written file.
   N/A path N/A N/A N/A os path join output_path name N/A N/A open path wb f N/A N/A N/A N/A f write content N/A path N/A GenApiConfig N/A N/A service_class_names generator hostname N/A None None N/A N/A Write an API configuration for endpoints annotated ProtoRPC services.

  Args:
    service_class_names: A list of fully qualified ProtoRPC service classes.
    generator: An generator object that produces API config strings using its
      pretty_print_config_to_json method.
    hostname: A string hostname which will be used as the default version
      hostname. If no hostname is specificied in the @endpoints.api decorator,
      this value is the fallback. Defaults to None.

  Raises:
    TypeError: If any service classes don't inherit from remote.Service.
    messages.DefinitionNotFoundError: If a service can't be found.

  Returns:
    A map from service names to a string containing the API configuration of the
      service in JSON format.
   N/A service_map N/A N/A generator N/A generator N/A N/A api_config ApiConfigGenerator N/A service_class_name service_class_names N/A N/A N/A module_name base_service_class_name N/A N/A service_class_name rsplit . 1 N/A module N/A __import__ module_name fromlist base_service_class_name N/A service N/A getattr module base_service_class_name N/A N/A N/A N/A isinstance service type N/A issubclass service N/A remote Service N/A N/A N/A TypeError N/A %s is not a ProtoRPC service service_class_name N/A hostname N/A N/A N/A service api_info hostname hostname N/A N/A service_map N/A service_class_name N/A N/A generator pretty_print_config_to_json service hostname hostname N/A service_map N/A GenDiscoveryDoc N/A N/A service_class_names doc_format output_path hostname N/A None N/A N/A Write discovery documents generated from a cloud service to file.

  Args:
    service_class_names: A list of fully qualified ProtoRPC service names.
    doc_format: The requested format for the discovery doc. (rest|rpc)
    output_path: The directory to output the discovery docs to.
    hostname: A string hostname which will be used as the default version
      hostname. If no hostname is specificied in the @endpoints.api decorator,
      this value is the fallback. Defaults to None.

  Raises:
    ServerRequestException: If fetching the generated discovery doc fails.

  Returns:
    A mapping from service names to discovery docs.
   N/A output_files N/A N/A service_configs N/A GenApiConfig service_class_names hostname hostname N/A N/A service_class_name config N/A N/A service_configs iteritems N/A N/A body N/A N/A json dumps N/A config config indent 2 sort_keys True N/A request N/A N/A urllib2 Request N/A DISCOVERY_DOC_BASE doc_format body N/A N/A N/A request add_header content-type application/json N/A N/A N/A N/A N/A contextlib closing N/A N/A urllib2 urlopen request response N/A N/A content N/A N/A response read N/A N/A _ base_service_class_name N/A N/A service_class_name rsplit . 1 N/A discovery_name N/A base_service_class_name .discovery N/A N/A N/A output_files append N/A _WriteFile output_path discovery_name content N/A N/A N/A N/A urllib2 HTTPError N/A error N/A N/A N/A ServerRequestException error N/A output_files N/A GenClientLib N/A N/A discovery_path language output_path N/A N/A N/A Write a client library from a discovery doc, using a cloud service to file.

  Args:
    discovery_path: Path to the discovery doc used to generate the client
      library.
    language: The client library language to generate. (java)
    output_path: The directory to output the client library zip to.

  Raises:
    IOError: If reading the discovery doc fails.
    ServerRequestException: If fetching the generated client library fails.

  Returns:
    The path to the zipped client library.
   N/A N/A open discovery_path f N/A N/A discovery_doc N/A N/A f read N/A client_name N/A N/A re sub \.discovery$ .zip N/A N/A N/A os path basename discovery_path N/A N/A _GenClientLibFromContents discovery_doc language output_path client_name N/A _GenClientLibFromContents N/A N/A discovery_doc language output_path client_name N/A N/A N/A Write a client library from a discovery doc, using a cloud service to file.

  Args:
    discovery_doc: A string, the contents of the discovery doc used to
      generate the client library.
    language: A string, the client library language to generate. (java)
    output_path: A string, the directory to output the client library zip to.
    client_name: A string, the filename used to save the client lib.

  Raises:
    IOError: If reading the discovery doc fails.
    ServerRequestException: If fetching the generated client library fails.

  Returns:
    The path to the zipped client library.
   N/A body N/A N/A urllib urlencode N/A lang content language discovery_doc N/A request N/A N/A urllib2 Request CLIENT_LIBRARY_BASE body N/A N/A N/A N/A N/A contextlib closing N/A N/A urllib2 urlopen request response N/A N/A content N/A N/A response read N/A N/A _WriteFile output_path client_name content N/A N/A N/A N/A urllib2 HTTPError N/A error N/A N/A N/A ServerRequestException error N/A GetClientLib N/A N/A service_class_names doc_format language output_path hostname N/A None N/A N/A Fetch discovery documents and client libraries from a cloud service.

  Args:
    service_class_names: A list of fully qualified ProtoRPC service names.
    doc_format: The requested format for the discovery doc. (rest|rpc)
    language: The client library language to generate. (java)
    output_path: The directory to output the discovery docs to.
    hostname: A string hostname which will be used as the default version
      hostname. If no hostname is specificied in the @endpoints.api decorator,
      this value is the fallback. Defaults to None.

  Returns:
    A tuple (discovery_files, client_libs):
      discovery_files: A list of paths to discovery documents.
      client_libs: A list of paths to client libraries.
   N/A discovery_files N/A GenDiscoveryDoc service_class_names doc_format output_path hostname hostname N/A client_libs N/A N/A discovery_path discovery_files N/A N/A N/A N/A client_libs append N/A GenClientLib discovery_path language output_path N/A N/A discovery_files client_libs N/A _GenApiConfigCallback N/A N/A args api_func N/A GenApiConfig N/A N/A Generate an api file.

  Args:
    args: An argparse.Namespace object to extract parameters from.
    api_func: A function that generates and returns an API configuration
      for a list of services.
   N/A N/A service_class_names output_path hostname N/A N/A args service N/A args output N/A args hostname N/A service_configs N/A api_func service_class_names hostname hostname N/A N/A service_class_name config N/A N/A service_configs iteritems N/A N/A N/A _ base_service_class_name N/A N/A service_class_name rsplit . 1 N/A api_name N/A base_service_class_name .api N/A N/A _WriteFile output_path api_name config N/A _GetClientLibCallback N/A N/A args client_func N/A GetClientLib N/A N/A Generate discovery docs and client libraries to files.

  Args:
    args: An argparse.Namespace object to extract parameters from.
    client_func: A function that generates client libraries and stores them to
      files, accepting a list of service names, a discovery doc format, a client
      library language, and an output directory.
   N/A N/A service_class_names doc_format language output_path hostname N/A N/A args service N/A args format N/A args language N/A args output N/A args hostname N/A N/A discovery_paths client_paths N/A client_func service_class_names doc_format language output_path hostname hostname N/A discovery_path discovery_paths N/A N/A N/A API discovery document written to %s discovery_path N/A client_path client_paths N/A N/A N/A API client library written to %s client_path N/A _GenDiscoveryDocCallback N/A N/A args discovery_func N/A GenDiscoveryDoc N/A N/A Generate discovery docs to files.

  Args:
    args: An argparse.Namespace object to extract parameters from
    discovery_func: A function that generates discovery docs and stores them to
      files, accepting a list of service names, a discovery doc format, and an
      output directory.
   N/A N/A services doc_format output_path hostname N/A N/A args service N/A args format N/A args output N/A args hostname N/A discovery_paths N/A discovery_func services doc_format output_path hostname hostname N/A discovery_path discovery_paths N/A N/A N/A API discovery document written to %s discovery_path N/A _GenClientLibCallback N/A N/A args client_func N/A GenClientLib N/A N/A Generate a client library to file.

  Args:
    args: An argparse.Namespace object to extract parameters from
    client_func: A function that generates client libraries and stores them to
      files, accepting a path to a discovery doc, a client library language, and
      an output directory.
   N/A N/A discovery_path language output_path N/A N/A N/A args discovery_doc N/A 0 N/A args language N/A args output N/A client_path N/A client_func discovery_path language output_path N/A N/A API client library written to %s client_path N/A MakeParser N/A N/A prog N/A N/A N/A Create an argument parser.

  Args:
    prog: The name of the program to use when outputting help text.

  Returns:
    An argparse.ArgumentParser built to specification.
   N/A argparse AddStandardOptions N/A N/A parser N/A args N/A N/A Add common endpoints options to a parser.

    Args:
      parser: The parser to add options to.
      *args: A list of option names to add. Possible names are: application,
        format, output, language, service, and discovery_doc.
     N/A N/A application args N/A N/A N/A N/A parser add_argument -a --application default . help The path to the Python App Engine App N/A N/A format args N/A N/A N/A N/A parser add_argument -f --format default rest choices N/A rest rpc help The requested API protocol type N/A N/A hostname args N/A N/A help_text Default application hostname, if none is specified for API service. N/A N/A N/A parser add_argument --hostname help help_text N/A N/A output args N/A N/A N/A N/A parser add_argument -o --output default . help The directory to store output files N/A N/A language args N/A N/A N/A N/A parser add_argument language choices N/A java help The target output programming language N/A N/A service args N/A N/A N/A N/A parser add_argument service nargs + help Fully qualified service class name N/A N/A discovery_doc args N/A N/A N/A N/A parser add_argument discovery_doc nargs 1 help Path to the discovery document N/A N/A parser N/A N/A argparse ArgumentParser prog prog N/A subparsers N/A N/A parser add_subparsers title subcommands N/A get_client_lib N/A N/A subparsers add_parser get_client_lib help Generates discovery documents and client libraries from service classes N/A N/A N/A get_client_lib set_defaults callback _GetClientLibCallback N/A N/A AddStandardOptions get_client_lib application format hostname output language service N/A gen_api_config N/A N/A subparsers add_parser gen_api_config help Generates an .api file for the given service classes N/A N/A N/A gen_api_config set_defaults callback _GenApiConfigCallback N/A N/A AddStandardOptions gen_api_config application hostname output service N/A gen_discovery_doc N/A N/A subparsers add_parser gen_discovery_doc help Generates discovery documents from service classes N/A N/A N/A gen_discovery_doc set_defaults callback _GenDiscoveryDocCallback N/A N/A AddStandardOptions gen_discovery_doc application format hostname output service N/A gen_client_lib N/A N/A subparsers add_parser gen_client_lib help Generates a client library from service classes N/A N/A N/A gen_client_lib set_defaults callback _GenClientLibCallback N/A N/A AddStandardOptions gen_client_lib output language discovery_doc N/A parser N/A main N/A N/A argv N/A N/A N/A parser N/A MakeParser N/A argv N/A 0 N/A args N/A N/A parser parse_args N/A argv N/A 1 N/A application_path N/A getattr args application None N/A N/A application_path None N/A N/A N/A N/A N/A sys path insert 0 N/A N/A N/A os path abspath application_path N/A N/A N/A args callback args N/A 0 N/A N/A N/A __name__ __main__ N/A N/A N/A N/A sys exit N/A main N/A sys argv