repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
cloudendpoints/endpoints-python
endpoints/apiserving.py
ApiConfigRegistry.__register_class
def __register_class(self, parsed_config): """Register the class implementing this config, so we only add it once. Args: parsed_config: The JSON object with the API configuration being added. Raises: ApiConfigurationError: If the class has already been registered. """ methods = parsed_...
python
def __register_class(self, parsed_config): """Register the class implementing this config, so we only add it once. Args: parsed_config: The JSON object with the API configuration being added. Raises: ApiConfigurationError: If the class has already been registered. """ methods = parsed_...
Register the class implementing this config, so we only add it once. Args: parsed_config: The JSON object with the API configuration being added. Raises: ApiConfigurationError: If the class has already been registered.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/apiserving.py#L209-L234
cloudendpoints/endpoints-python
endpoints/apiserving.py
ApiConfigRegistry.__register_methods
def __register_methods(self, parsed_config): """Register all methods from the given api config file. Methods are stored in a map from method_name to rosyMethod, the name of the ProtoRPC method to be called on the backend. If no rosyMethod was specified the value will be None. Args: parsed_co...
python
def __register_methods(self, parsed_config): """Register all methods from the given api config file. Methods are stored in a map from method_name to rosyMethod, the name of the ProtoRPC method to be called on the backend. If no rosyMethod was specified the value will be None. Args: parsed_co...
Register all methods from the given api config file. Methods are stored in a map from method_name to rosyMethod, the name of the ProtoRPC method to be called on the backend. If no rosyMethod was specified the value will be None. Args: parsed_config: The JSON object with the API configuration bei...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/apiserving.py#L236-L251
cloudendpoints/endpoints-python
endpoints/apiserving.py
_ApiServer.__create_name_version_map
def __create_name_version_map(api_services): """Create a map from API name/version to Service class/factory. This creates a map from an API name and version to a list of remote.Service factories that implement that API. Args: api_services: A list of remote.Service-derived classes or factories ...
python
def __create_name_version_map(api_services): """Create a map from API name/version to Service class/factory. This creates a map from an API name and version to a list of remote.Service factories that implement that API. Args: api_services: A list of remote.Service-derived classes or factories ...
Create a map from API name/version to Service class/factory. This creates a map from an API name and version to a list of remote.Service factories that implement that API. Args: api_services: A list of remote.Service-derived classes or factories created with remote.Service.new_factory. ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/apiserving.py#L355-L389
cloudendpoints/endpoints-python
endpoints/apiserving.py
_ApiServer.__register_services
def __register_services(api_name_version_map, api_config_registry): """Register & return a list of each URL and class that handles that URL. This finds every service class in api_name_version_map, registers it with the given ApiConfigRegistry, builds the URL for that class, and adds the URL and its fac...
python
def __register_services(api_name_version_map, api_config_registry): """Register & return a list of each URL and class that handles that URL. This finds every service class in api_name_version_map, registers it with the given ApiConfigRegistry, builds the URL for that class, and adds the URL and its fac...
Register & return a list of each URL and class that handles that URL. This finds every service class in api_name_version_map, registers it with the given ApiConfigRegistry, builds the URL for that class, and adds the URL and its factory to a list that's returned. Args: api_name_version_map: A ma...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/apiserving.py#L392-L432
cloudendpoints/endpoints-python
endpoints/apiserving.py
_ApiServer.__is_json_error
def __is_json_error(self, status, headers): """Determine if response is an error. Args: status: HTTP status code. headers: Dictionary of (lowercase) header name to value. Returns: True if the response was an error, else False. """ content_header = headers.get('content-type', '') ...
python
def __is_json_error(self, status, headers): """Determine if response is an error. Args: status: HTTP status code. headers: Dictionary of (lowercase) header name to value. Returns: True if the response was an error, else False. """ content_header = headers.get('content-type', '') ...
Determine if response is an error. Args: status: HTTP status code. headers: Dictionary of (lowercase) header name to value. Returns: True if the response was an error, else False.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/apiserving.py#L434-L447
cloudendpoints/endpoints-python
endpoints/apiserving.py
_ApiServer.__write_error
def __write_error(self, status_code, error_message=None): """Return the HTTP status line and body for a given error code and message. Args: status_code: HTTP status code to be returned. error_message: Error message to be returned. Returns: Tuple (http_status, body): http_status: ...
python
def __write_error(self, status_code, error_message=None): """Return the HTTP status line and body for a given error code and message. Args: status_code: HTTP status code to be returned. error_message: Error message to be returned. Returns: Tuple (http_status, body): http_status: ...
Return the HTTP status line and body for a given error code and message. Args: status_code: HTTP status code to be returned. error_message: Error message to be returned. Returns: Tuple (http_status, body): http_status: HTTP status line, e.g. 200 OK. body: Body of the HTTP req...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/apiserving.py#L449-L467
cloudendpoints/endpoints-python
endpoints/apiserving.py
_ApiServer.protorpc_to_endpoints_error
def protorpc_to_endpoints_error(self, status, body): """Convert a ProtoRPC error to the format expected by Google Endpoints. If the body does not contain an ProtoRPC message in state APPLICATION_ERROR the status and body will be returned unchanged. Args: status: HTTP status of the response from ...
python
def protorpc_to_endpoints_error(self, status, body): """Convert a ProtoRPC error to the format expected by Google Endpoints. If the body does not contain an ProtoRPC message in state APPLICATION_ERROR the status and body will be returned unchanged. Args: status: HTTP status of the response from ...
Convert a ProtoRPC error to the format expected by Google Endpoints. If the body does not contain an ProtoRPC message in state APPLICATION_ERROR the status and body will be returned unchanged. Args: status: HTTP status of the response from the backend body: JSON-encoded error in format expecte...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/apiserving.py#L469-L494
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware._add_dispatcher
def _add_dispatcher(self, path_regex, dispatch_function): """Add a request path and dispatch handler. Args: path_regex: A string regex, the path to match against incoming requests. dispatch_function: The function to call for these requests. The function should take (request, start_response...
python
def _add_dispatcher(self, path_regex, dispatch_function): """Add a request path and dispatch handler. Args: path_regex: A string regex, the path to match against incoming requests. dispatch_function: The function to call for these requests. The function should take (request, start_response...
Add a request path and dispatch handler. Args: path_regex: A string regex, the path to match against incoming requests. dispatch_function: The function to call for these requests. The function should take (request, start_response) as arguments and return the contents of the response bo...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L103-L112
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.dispatch
def dispatch(self, request, start_response): """Handles dispatch to apiserver handlers. This typically ends up calling start_response and returning the entire body of the response. Args: request: An ApiRequest, the request from the user. start_response: A function with semantics defined ...
python
def dispatch(self, request, start_response): """Handles dispatch to apiserver handlers. This typically ends up calling start_response and returning the entire body of the response. Args: request: An ApiRequest, the request from the user. start_response: A function with semantics defined ...
Handles dispatch to apiserver handlers. This typically ends up calling start_response and returning the entire body of the response. Args: request: An ApiRequest, the request from the user. start_response: A function with semantics defined in PEP-333. Returns: A string, the body o...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L149-L172
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.dispatch_non_api_requests
def dispatch_non_api_requests(self, request, start_response): """Dispatch this request if this is a request to a reserved URL. If the request matches one of our reserved URLs, this calls start_response and returns the response body. This also handles OPTIONS CORS requests. Args: request: An...
python
def dispatch_non_api_requests(self, request, start_response): """Dispatch this request if this is a request to a reserved URL. If the request matches one of our reserved URLs, this calls start_response and returns the response body. This also handles OPTIONS CORS requests. Args: request: An...
Dispatch this request if this is a request to a reserved URL. If the request matches one of our reserved URLs, this calls start_response and returns the response body. This also handles OPTIONS CORS requests. Args: request: An ApiRequest, the request from the user. start_response: A funct...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L174-L200
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.handle_api_explorer_request
def handle_api_explorer_request(self, request, start_response): """Handler for requests to {base_path}/explorer. This calls start_response and returns the response body. Args: request: An ApiRequest, the request from the user. start_response: A function with semantics defined in PEP-333. ...
python
def handle_api_explorer_request(self, request, start_response): """Handler for requests to {base_path}/explorer. This calls start_response and returns the response body. Args: request: An ApiRequest, the request from the user. start_response: A function with semantics defined in PEP-333. ...
Handler for requests to {base_path}/explorer. This calls start_response and returns the response body. Args: request: An ApiRequest, the request from the user. start_response: A function with semantics defined in PEP-333. Returns: A string containing the response body (which is empty, i...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L202-L216
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.handle_api_static_request
def handle_api_static_request(self, request, start_response): """Handler for requests to {base_path}/static/.*. This calls start_response and returns the response body. Args: request: An ApiRequest, the request from the user. start_response: A function with semantics defined in PEP-333. R...
python
def handle_api_static_request(self, request, start_response): """Handler for requests to {base_path}/static/.*. This calls start_response and returns the response body. Args: request: An ApiRequest, the request from the user. start_response: A function with semantics defined in PEP-333. R...
Handler for requests to {base_path}/static/.*. This calls start_response and returns the response body. Args: request: An ApiRequest, the request from the user. start_response: A function with semantics defined in PEP-333. Returns: A string containing the response body.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L218-L240
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.verify_response
def verify_response(response, status_code, content_type=None): """Verifies that a response has the expected status and content type. Args: response: The ResponseTuple to be checked. status_code: An int, the HTTP status code to be compared with response status. content_type: A string w...
python
def verify_response(response, status_code, content_type=None): """Verifies that a response has the expected status and content type. Args: response: The ResponseTuple to be checked. status_code: An int, the HTTP status code to be compared with response status. content_type: A string w...
Verifies that a response has the expected status and content type. Args: response: The ResponseTuple to be checked. status_code: An int, the HTTP status code to be compared with response status. content_type: A string with the acceptable Content-Type header value. None allows any ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L246-L271
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.prepare_backend_environ
def prepare_backend_environ(self, host, method, relative_url, headers, body, source_ip, port): """Build an environ object for the backend to consume. Args: host: A string containing the host serving the request. method: A string containing the HTTP method of the reques...
python
def prepare_backend_environ(self, host, method, relative_url, headers, body, source_ip, port): """Build an environ object for the backend to consume. Args: host: A string containing the host serving the request. method: A string containing the HTTP method of the reques...
Build an environ object for the backend to consume. Args: host: A string containing the host serving the request. method: A string containing the HTTP method of the request. relative_url: A string containing path and query string of the request. headers: A list of (key, value) tuples where ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L273-L315
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.call_backend
def call_backend(self, orig_request, start_response): """Generate API call (from earlier-saved request). This calls start_response and returns the response body. Args: orig_request: An ApiRequest, the original request from the user. start_response: A function with semantics defined in PEP-333....
python
def call_backend(self, orig_request, start_response): """Generate API call (from earlier-saved request). This calls start_response and returns the response body. Args: orig_request: An ApiRequest, the original request from the user. start_response: A function with semantics defined in PEP-333....
Generate API call (from earlier-saved request). This calls start_response and returns the response body. Args: orig_request: An ApiRequest, the original request from the user. start_response: A function with semantics defined in PEP-333. Returns: A string containing the response body.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L317-L369
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.handle_backend_response
def handle_backend_response(self, orig_request, backend_request, response_status, response_headers, response_body, method_config, start_response): """Handle backend response, transforming output as needed. This calls start_response and returns the res...
python
def handle_backend_response(self, orig_request, backend_request, response_status, response_headers, response_body, method_config, start_response): """Handle backend response, transforming output as needed. This calls start_response and returns the res...
Handle backend response, transforming output as needed. This calls start_response and returns the response body. Args: orig_request: An ApiRequest, the original request from the user. backend_request: An ApiRequest, the transformed request that was sent to the backend handle...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L415-L457
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.fail_request
def fail_request(self, orig_request, message, start_response): """Write an immediate failure response to outfile, no redirect. This calls start_response and returns the error body. Args: orig_request: An ApiRequest, the original request from the user. message: A string containing the error mes...
python
def fail_request(self, orig_request, message, start_response): """Write an immediate failure response to outfile, no redirect. This calls start_response and returns the error body. Args: orig_request: An ApiRequest, the original request from the user. message: A string containing the error mes...
Write an immediate failure response to outfile, no redirect. This calls start_response and returns the error body. Args: orig_request: An ApiRequest, the original request from the user. message: A string containing the error message to be displayed to user. start_response: A function with se...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L459-L474
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.lookup_rest_method
def lookup_rest_method(self, orig_request): """Looks up and returns rest method for the currently-pending request. Args: orig_request: An ApiRequest, the original request from the user. Returns: A tuple of (method descriptor, parameters), or (None, None) if no method was found for the cu...
python
def lookup_rest_method(self, orig_request): """Looks up and returns rest method for the currently-pending request. Args: orig_request: An ApiRequest, the original request from the user. Returns: A tuple of (method descriptor, parameters), or (None, None) if no method was found for the cu...
Looks up and returns rest method for the currently-pending request. Args: orig_request: An ApiRequest, the original request from the user. Returns: A tuple of (method descriptor, parameters), or (None, None) if no method was found for the current request.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L476-L489
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.transform_request
def transform_request(self, orig_request, params, method_config): """Transforms orig_request to apiserving request. This method uses orig_request to determine the currently-pending request and returns a new transformed request ready to send to the backend. This method accepts a rest-style or RPC-style...
python
def transform_request(self, orig_request, params, method_config): """Transforms orig_request to apiserving request. This method uses orig_request to determine the currently-pending request and returns a new transformed request ready to send to the backend. This method accepts a rest-style or RPC-style...
Transforms orig_request to apiserving request. This method uses orig_request to determine the currently-pending request and returns a new transformed request ready to send to the backend. This method accepts a rest-style or RPC-style request. Args: orig_request: An ApiRequest, the original requ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L491-L512
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware._add_message_field
def _add_message_field(self, field_name, value, params): """Converts a . delimitied field name to a message field in parameters. This adds the field to the params dict, broken out so that message parameters appear as sub-dicts within the outer param. For example: {'a.b.c': ['foo']} becomes: ...
python
def _add_message_field(self, field_name, value, params): """Converts a . delimitied field name to a message field in parameters. This adds the field to the params dict, broken out so that message parameters appear as sub-dicts within the outer param. For example: {'a.b.c': ['foo']} becomes: ...
Converts a . delimitied field name to a message field in parameters. This adds the field to the params dict, broken out so that message parameters appear as sub-dicts within the outer param. For example: {'a.b.c': ['foo']} becomes: {'a': {'b': {'c': ['foo']}}} Args: field_name: ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L514-L538
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware._update_from_body
def _update_from_body(self, destination, source): """Updates the dictionary for an API payload with the request body. The values from the body should override those already in the payload, but for nested fields (message objects) the values can be combined recursively. Args: destination: A di...
python
def _update_from_body(self, destination, source): """Updates the dictionary for an API payload with the request body. The values from the body should override those already in the payload, but for nested fields (message objects) the values can be combined recursively. Args: destination: A di...
Updates the dictionary for an API payload with the request body. The values from the body should override those already in the payload, but for nested fields (message objects) the values can be combined recursively. Args: destination: A dictionary containing an API payload parsed from the ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L540-L557
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.transform_rest_request
def transform_rest_request(self, orig_request, params, method_parameters): """Translates a Rest request into an apiserving request. This makes a copy of orig_request and transforms it to apiserving format (moving request parameters to the body). The request can receive values from the path, query and ...
python
def transform_rest_request(self, orig_request, params, method_parameters): """Translates a Rest request into an apiserving request. This makes a copy of orig_request and transforms it to apiserving format (moving request parameters to the body). The request can receive values from the path, query and ...
Translates a Rest request into an apiserving request. This makes a copy of orig_request and transforms it to apiserving format (moving request parameters to the body). The request can receive values from the path, query and body and combine them before sending them along to the backend. In cases of co...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L559-L645
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.check_error_response
def check_error_response(self, body, status): """Raise an exception if the response from the backend was an error. Args: body: A string containing the backend response body. status: A string containing the backend response status. Raises: BackendError if the response is an error. """...
python
def check_error_response(self, body, status): """Raise an exception if the response from the backend was an error. Args: body: A string containing the backend response body. status: A string containing the backend response status. Raises: BackendError if the response is an error. """...
Raise an exception if the response from the backend was an error. Args: body: A string containing the backend response body. status: A string containing the backend response status. Raises: BackendError if the response is an error.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L647-L659
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.check_empty_response
def check_empty_response(self, orig_request, method_config, start_response): """If the response from the backend is empty, return a HTTP 204 No Content. Args: orig_request: An ApiRequest, the original request from the user. method_config: A dict, the API config of the method to be called. sta...
python
def check_empty_response(self, orig_request, method_config, start_response): """If the response from the backend is empty, return a HTTP 204 No Content. Args: orig_request: An ApiRequest, the original request from the user. method_config: A dict, the API config of the method to be called. sta...
If the response from the backend is empty, return a HTTP 204 No Content. Args: orig_request: An ApiRequest, the original request from the user. method_config: A dict, the API config of the method to be called. start_response: A function with semantics defined in PEP-333. Returns: If th...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L661-L681
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware.transform_rest_response
def transform_rest_response(self, response_body): """Translates an apiserving REST response so it's ready to return. Currently, the only thing that needs to be fixed here is indentation, so it's consistent with what the live app will return. Args: response_body: A string containing the backend r...
python
def transform_rest_response(self, response_body): """Translates an apiserving REST response so it's ready to return. Currently, the only thing that needs to be fixed here is indentation, so it's consistent with what the live app will return. Args: response_body: A string containing the backend r...
Translates an apiserving REST response so it's ready to return. Currently, the only thing that needs to be fixed here is indentation, so it's consistent with what the live app will return. Args: response_body: A string containing the backend response. Returns: A reformatted version of the...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L683-L696
cloudendpoints/endpoints-python
endpoints/endpoints_dispatcher.py
EndpointsDispatcherMiddleware._handle_request_error
def _handle_request_error(self, orig_request, error, start_response): """Handle a request error, converting it to a WSGI response. Args: orig_request: An ApiRequest, the original request from the user. error: A RequestError containing information about the error. start_response: A function wi...
python
def _handle_request_error(self, orig_request, error, start_response): """Handle a request error, converting it to a WSGI response. Args: orig_request: An ApiRequest, the original request from the user. error: A RequestError containing information about the error. start_response: A function wi...
Handle a request error, converting it to a WSGI response. Args: orig_request: An ApiRequest, the original request from the user. error: A RequestError containing information about the error. start_response: A function with semantics defined in PEP-333. Returns: A string containing the ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/endpoints_dispatcher.py#L698-L718
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
_WriteFile
def _WriteFile(output_path, name, content): """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...
python
def _WriteFile(output_path, name, content): """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...
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.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L138-L152
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
GenApiConfig
def GenApiConfig(service_class_names, config_string_generator=None, hostname=None, application_path=None, **additional_kwargs): """Write an API configuration for endpoints annotated ProtoRPC services. Args: service_class_names: A list of fully qualified ProtoRPC service classes. config_str...
python
def GenApiConfig(service_class_names, config_string_generator=None, hostname=None, application_path=None, **additional_kwargs): """Write an API configuration for endpoints annotated ProtoRPC services. Args: service_class_names: A list of fully qualified ProtoRPC service classes. config_str...
Write an API configuration for endpoints annotated ProtoRPC services. Args: service_class_names: A list of fully qualified ProtoRPC service classes. config_string_generator: A generator object that produces API config strings using its pretty_print_config_to_json method. hostname: A string hostname...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L155-L218
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
_GetAppYamlHostname
def _GetAppYamlHostname(application_path, open_func=open): """Build the hostname for this app based on the name in app.yaml. Args: application_path: A string with the path to the AppEngine application. This should be the directory containing the app.yaml file. open_func: Function to call to open a f...
python
def _GetAppYamlHostname(application_path, open_func=open): """Build the hostname for this app based on the name in app.yaml. Args: application_path: A string with the path to the AppEngine application. This should be the directory containing the app.yaml file. open_func: Function to call to open a f...
Build the hostname for this app based on the name in app.yaml. Args: application_path: A string with the path to the AppEngine application. This should be the directory containing the app.yaml file. open_func: Function to call to open a file. Used to override the default open function in unit t...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L221-L257
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
_GenDiscoveryDoc
def _GenDiscoveryDoc(service_class_names, output_path, hostname=None, application_path=None): """Write discovery documents generated from the service classes to file. Args: service_class_names: A list of fully qualified ProtoRPC service names. output_path: The dire...
python
def _GenDiscoveryDoc(service_class_names, output_path, hostname=None, application_path=None): """Write discovery documents generated from the service classes to file. Args: service_class_names: A list of fully qualified ProtoRPC service names. output_path: The dire...
Write discovery documents generated from the service classes to file. Args: service_class_names: A list of fully qualified ProtoRPC service names. 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 hostna...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L260-L285
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
_GenOpenApiSpec
def _GenOpenApiSpec(service_class_names, output_path, hostname=None, application_path=None, x_google_api_name=False): """Write openapi documents generated from the service classes to file. Args: service_class_names: A list of fully qualified ProtoRPC service names. output_path: The dire...
python
def _GenOpenApiSpec(service_class_names, output_path, hostname=None, application_path=None, x_google_api_name=False): """Write openapi documents generated from the service classes to file. Args: service_class_names: A list of fully qualified ProtoRPC service names. output_path: The dire...
Write openapi documents generated from the service classes to file. Args: service_class_names: A list of fully qualified ProtoRPC service names. output_path: The directory to which to output the OpenAPI specs. hostname: A string hostname which will be used as the default version hostname. If no hos...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L288-L313
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
_GenClientLib
def _GenClientLib(discovery_path, language, output_path, build_system): """Write a client library from a discovery doc. 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 outp...
python
def _GenClientLib(discovery_path, language, output_path, build_system): """Write a client library from a discovery doc. 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 outp...
Write a client library from a discovery doc. 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. build_system: The target build system for t...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L316-L340
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
_GenClientLibFromContents
def _GenClientLibFromContents(discovery_doc, language, output_path, build_system, client_name): """Write a client library from a discovery doc. Args: discovery_doc: A string, the contents of the discovery doc used to generate the client library. language: A string, the c...
python
def _GenClientLibFromContents(discovery_doc, language, output_path, build_system, client_name): """Write a client library from a discovery doc. Args: discovery_doc: A string, the contents of the discovery doc used to generate the client library. language: A string, the c...
Write a client library from a discovery doc. 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. build_...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L343-L371
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
_GetClientLib
def _GetClientLib(service_class_names, language, output_path, build_system, hostname=None, application_path=None): """Fetch client libraries from a cloud service. Args: service_class_names: A list of fully qualified ProtoRPC service names. language: The client library language to generate...
python
def _GetClientLib(service_class_names, language, output_path, build_system, hostname=None, application_path=None): """Fetch client libraries from a cloud service. Args: service_class_names: A list of fully qualified ProtoRPC service names. language: The client library language to generate...
Fetch client libraries from a cloud service. Args: service_class_names: A list of fully qualified ProtoRPC service names. language: The client library language to generate. (java) output_path: The directory to output the discovery docs to. build_system: The target build system for the client library ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L374-L401
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
_GenApiConfigCallback
def _GenApiConfigCallback(args, api_func=GenApiConfig): """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. """ service_configs = api_func(args.service, ...
python
def _GenApiConfigCallback(args, api_func=GenApiConfig): """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. """ service_configs = api_func(args.service, ...
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.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L404-L417
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
_GetClientLibCallback
def _GetClientLibCallback(args, client_func=_GetClientLib): """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 name...
python
def _GetClientLibCallback(args, client_func=_GetClientLib): """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 name...
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 client library language, an output directory, a build ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L420-L435
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
_GenDiscoveryDocCallback
def _GenDiscoveryDocCallback(args, discovery_func=_GenDiscoveryDoc): """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 discove...
python
def _GenDiscoveryDocCallback(args, discovery_func=_GenDiscoveryDoc): """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 discove...
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.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L438-L451
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
_GenOpenApiSpecCallback
def _GenOpenApiSpecCallback(args, openapi_func=_GenOpenApiSpec): """Generate OpenAPI (Swagger) specs to files. Args: args: An argparse.Namespace object to extract parameters from openapi_func: A function that generates OpenAPI specs and stores them to files, accepting a list of service names and an o...
python
def _GenOpenApiSpecCallback(args, openapi_func=_GenOpenApiSpec): """Generate OpenAPI (Swagger) specs to files. Args: args: An argparse.Namespace object to extract parameters from openapi_func: A function that generates OpenAPI specs and stores them to files, accepting a list of service names and an o...
Generate OpenAPI (Swagger) specs to files. Args: args: An argparse.Namespace object to extract parameters from openapi_func: A function that generates OpenAPI specs and stores them to files, accepting a list of service names and an output directory.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L454-L467
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
_GenClientLibCallback
def _GenClientLibCallback(args, client_func=_GenClientLib): """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...
python
def _GenClientLibCallback(args, client_func=_GenClientLib): """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...
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, an output directory, and a build system for the ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L470-L481
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
MakeParser
def MakeParser(prog): """Create an argument parser. Args: prog: The name of the program to use when outputting help text. Returns: An argparse.ArgumentParser built to specification. """ def AddStandardOptions(parser, *args): """Add common endpoints options to a parser. Args: parser: ...
python
def MakeParser(prog): """Create an argument parser. Args: prog: The name of the program to use when outputting help text. Returns: An argparse.ArgumentParser built to specification. """ def AddStandardOptions(parser, *args): """Add common endpoints options to a parser. Args: parser: ...
Create an argument parser. Args: prog: The name of the program to use when outputting help text. Returns: An argparse.ArgumentParser built to specification.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L484-L586
cloudendpoints/endpoints-python
endpoints/_endpointscfg_impl.py
_EndpointsParser.error
def error(self, message): """Override superclass to support customized error message. Error message needs to be rewritten in order to display visible commands only, when invalid command is called by user. Otherwise, hidden commands will be displayed in stderr, which is not expected. Refer the foll...
python
def error(self, message): """Override superclass to support customized error message. Error message needs to be rewritten in order to display visible commands only, when invalid command is called by user. Otherwise, hidden commands will be displayed in stderr, which is not expected. Refer the foll...
Override superclass to support customized error message. Error message needs to be rewritten in order to display visible commands only, when invalid command is called by user. Otherwise, hidden commands will be displayed in stderr, which is not expected. Refer the following argparse python documentati...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_impl.py#L111-L135
cloudendpoints/endpoints-python
endpoints/_endpointscfg_setup.py
_SetupPaths
def _SetupPaths(): """Sets up the sys.path with special directories for endpointscfg.py.""" sdk_path = _FindSdkPath() if sdk_path: sys.path.append(sdk_path) try: import dev_appserver # pylint: disable=g-import-not-at-top if hasattr(dev_appserver, 'fix_sys_path'): dev_appserver.fix_sys...
python
def _SetupPaths(): """Sets up the sys.path with special directories for endpointscfg.py.""" sdk_path = _FindSdkPath() if sdk_path: sys.path.append(sdk_path) try: import dev_appserver # pylint: disable=g-import-not-at-top if hasattr(dev_appserver, 'fix_sys_path'): dev_appserver.fix_sys...
Sets up the sys.path with special directories for endpointscfg.py.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/_endpointscfg_setup.py#L84-L104
cloudendpoints/endpoints-python
endpoints/api_config.py
_Enum
def _Enum(docstring, *names): """Utility to generate enum classes used by annotations. Args: docstring: Docstring for the generated enum class. *names: Enum names. Returns: A class that contains enum names as attributes. """ enums = dict(zip(names, range(len(names)))) reverse = dict((value, ke...
python
def _Enum(docstring, *names): """Utility to generate enum classes used by annotations. Args: docstring: Docstring for the generated enum class. *names: Enum names. Returns: A class that contains enum names as attributes. """ enums = dict(zip(names, range(len(names)))) reverse = dict((value, ke...
Utility to generate enum classes used by annotations. Args: docstring: Docstring for the generated enum class. *names: Enum names. Returns: A class that contains enum names as attributes.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L102-L116
cloudendpoints/endpoints-python
endpoints/api_config.py
_CheckType
def _CheckType(value, check_type, name, allow_none=True): """Check that the type of an object is acceptable. Args: value: The object whose type is to be checked. check_type: The type that the object must be an instance of. name: Name of the object, to be placed in any error messages. allow_none: Tr...
python
def _CheckType(value, check_type, name, allow_none=True): """Check that the type of an object is acceptable. Args: value: The object whose type is to be checked. check_type: The type that the object must be an instance of. name: Name of the object, to be placed in any error messages. allow_none: Tr...
Check that the type of an object is acceptable. Args: value: The object whose type is to be checked. check_type: The type that the object must be an instance of. name: Name of the object, to be placed in any error messages. allow_none: True if value can be None, false if not. Raises: TypeError...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L190-L205
cloudendpoints/endpoints-python
endpoints/api_config.py
api
def api(name, version, description=None, hostname=None, audiences=None, scopes=None, allowed_client_ids=None, canonical_name=None, auth=None, owner_domain=None, owner_name=None, package_path=None, frontend_limits=None, title=None, documentation=None, auth_level=None, issuers=None, namesp...
python
def api(name, version, description=None, hostname=None, audiences=None, scopes=None, allowed_client_ids=None, canonical_name=None, auth=None, owner_domain=None, owner_name=None, package_path=None, frontend_limits=None, title=None, documentation=None, auth_level=None, issuers=None, namesp...
Decorate a ProtoRPC Service class for use by the framework above. This decorator can be used to specify an API name, version, description, and hostname for your API. Sample usage (python 2.7): @endpoints.api(name='guestbook', version='v0.2', description='Guestbook API') class PostServ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L988-L1077
cloudendpoints/endpoints-python
endpoints/api_config.py
method
def method(request_message=message_types.VoidMessage, response_message=message_types.VoidMessage, name=None, path=None, http_method='POST', scopes=None, audiences=None, allowed_client_ids=None, auth_level=None, api_key_re...
python
def method(request_message=message_types.VoidMessage, response_message=message_types.VoidMessage, name=None, path=None, http_method='POST', scopes=None, audiences=None, allowed_client_ids=None, auth_level=None, api_key_re...
Decorate a ProtoRPC Method for use by the framework above. This decorator can be used to specify a method name, path, http method, scopes, audiences, client ids and auth_level. Sample usage: @api_config.method(RequestMessage, ResponseMessage, name='insert', http_method='PUT') def ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1257-L1379
cloudendpoints/endpoints-python
endpoints/api_config.py
_ApiInfo.is_same_api
def is_same_api(self, other): """Check if this implements the same API as another _ApiInfo instance.""" if not isinstance(other, _ApiInfo): return False # pylint: disable=protected-access return self.__common_info is other.__common_info
python
def is_same_api(self, other): """Check if this implements the same API as another _ApiInfo instance.""" if not isinstance(other, _ApiInfo): return False # pylint: disable=protected-access return self.__common_info is other.__common_info
Check if this implements the same API as another _ApiInfo instance.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L307-L312
cloudendpoints/endpoints-python
endpoints/api_config.py
_ApiDecorator.api_class
def api_class(self, resource_name=None, path=None, audiences=None, scopes=None, allowed_client_ids=None, auth_level=None, api_key_required=None): """Get a decorator for a class that implements an API. This can be used for single-class or multi-class implementations. It's us...
python
def api_class(self, resource_name=None, path=None, audiences=None, scopes=None, allowed_client_ids=None, auth_level=None, api_key_required=None): """Get a decorator for a class that implements an API. This can be used for single-class or multi-class implementations. It's us...
Get a decorator for a class that implements an API. This can be used for single-class or multi-class implementations. It's used implicitly in simple single-class APIs that only use @api directly. Args: resource_name: string, Resource name for the class this decorates. (Default: None) ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L795-L842
cloudendpoints/endpoints-python
endpoints/api_config.py
_MethodInfo.__safe_name
def __safe_name(self, method_name): """Restrict method name to a-zA-Z0-9_, first char lowercase.""" # Endpoints backend restricts what chars are allowed in a method name. safe_name = re.sub(r'[^\.a-zA-Z0-9_]', '', method_name) # Strip any number of leading underscores. safe_name = safe_name.lstrip(...
python
def __safe_name(self, method_name): """Restrict method name to a-zA-Z0-9_, first char lowercase.""" # Endpoints backend restricts what chars are allowed in a method name. safe_name = re.sub(r'[^\.a-zA-Z0-9_]', '', method_name) # Strip any number of leading underscores. safe_name = safe_name.lstrip(...
Restrict method name to a-zA-Z0-9_, first char lowercase.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1126-L1136
cloudendpoints/endpoints-python
endpoints/api_config.py
_MethodInfo.get_path
def get_path(self, api_info): """Get the path portion of the URL to the method (for RESTful methods). Request path can be specified in the method, and it could have a base path prepended to it. Args: api_info: API information for this API, possibly including a base path. This is the api_...
python
def get_path(self, api_info): """Get the path portion of the URL to the method (for RESTful methods). Request path can be specified in the method, and it could have a base path prepended to it. Args: api_info: API information for this API, possibly including a base path. This is the api_...
Get the path portion of the URL to the method (for RESTful methods). Request path can be specified in the method, and it could have a base path prepended to it. Args: api_info: API information for this API, possibly including a base path. This is the api_info property on the class that's bee...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1143-L1178
cloudendpoints/endpoints-python
endpoints/api_config.py
_MethodInfo.method_id
def method_id(self, api_info): """Computed method name.""" # This is done here for now because at __init__ time, the method is known # but not the api, and thus not the api name. Later, in # ApiConfigGenerator.__method_descriptor, the api name is known. if api_info.resource_name: resource_par...
python
def method_id(self, api_info): """Computed method name.""" # This is done here for now because at __init__ time, the method is known # but not the api, and thus not the api name. Later, in # ApiConfigGenerator.__method_descriptor, the api name is known. if api_info.resource_name: resource_par...
Computed method name.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1243-L1253
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__field_to_subfields
def __field_to_subfields(self, field): """Fully describes data represented by field, including the nested case. In the case that the field is not a message field, we have no fields nested within a message definition, so we can simply return that field. However, in the nested case, we can't simply descr...
python
def __field_to_subfields(self, field): """Fully describes data represented by field, including the nested case. In the case that the field is not a message field, we have no fields nested within a message definition, so we can simply return that field. However, in the nested case, we can't simply descr...
Fully describes data represented by field, including the nested case. In the case that the field is not a message field, we have no fields nested within a message definition, so we can simply return that field. However, in the nested case, we can't simply describe the data with one field or even with o...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1438-L1503
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__field_to_parameter_type
def __field_to_parameter_type(self, field): """Converts the field variant type into a string describing the parameter. Args: field: An instance of a subclass of messages.Field. Returns: A string corresponding to the variant enum of the field, with a few exceptions. In the case of signe...
python
def __field_to_parameter_type(self, field): """Converts the field variant type into a string describing the parameter. Args: field: An instance of a subclass of messages.Field. Returns: A string corresponding to the variant enum of the field, with a few exceptions. In the case of signe...
Converts the field variant type into a string describing the parameter. Args: field: An instance of a subclass of messages.Field. Returns: A string corresponding to the variant enum of the field, with a few exceptions. In the case of signed ints, the 's' is dropped; for the BOOL va...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1507-L1532
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__get_path_parameters
def __get_path_parameters(self, path): """Parses path paremeters from a URI path and organizes them by parameter. Some of the parameters may correspond to message fields, and so will be represented as segments corresponding to each subfield; e.g. first.second if the field "second" in the message field ...
python
def __get_path_parameters(self, path): """Parses path paremeters from a URI path and organizes them by parameter. Some of the parameters may correspond to message fields, and so will be represented as segments corresponding to each subfield; e.g. first.second if the field "second" in the message field ...
Parses path paremeters from a URI path and organizes them by parameter. Some of the parameters may correspond to message fields, and so will be represented as segments corresponding to each subfield; e.g. first.second if the field "second" in the message field "first" is pulled from the path. The resu...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1534-L1559
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__validate_simple_subfield
def __validate_simple_subfield(self, parameter, field, segment_list, _segment_index=0): """Verifies that a proposed subfield actually exists and is a simple field. Here, simple means it is not a MessageField (nested). Args: parameter: String; the '.' delimited name o...
python
def __validate_simple_subfield(self, parameter, field, segment_list, _segment_index=0): """Verifies that a proposed subfield actually exists and is a simple field. Here, simple means it is not a MessageField (nested). Args: parameter: String; the '.' delimited name o...
Verifies that a proposed subfield actually exists and is a simple field. Here, simple means it is not a MessageField (nested). Args: parameter: String; the '.' delimited name of the current field being considered. This is relative to some root. field: An instance of a subclass of message...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1561-L1604
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__validate_path_parameters
def __validate_path_parameters(self, field, path_parameters): """Verifies that all path parameters correspond to an existing subfield. Args: field: An instance of a subclass of messages.Field. Should be the root level property name in each path parameter in path_parameters. For exampl...
python
def __validate_path_parameters(self, field, path_parameters): """Verifies that all path parameters correspond to an existing subfield. Args: field: An instance of a subclass of messages.Field. Should be the root level property name in each path parameter in path_parameters. For exampl...
Verifies that all path parameters correspond to an existing subfield. Args: field: An instance of a subclass of messages.Field. Should be the root level property name in each path parameter in path_parameters. For example, if the field is called 'foo', then each path parameter should ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1606-L1624
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__parameter_default
def __parameter_default(self, final_subfield): """Returns default value of final subfield if it has one. If this subfield comes from a field list returned from __field_to_subfields, none of the fields in the subfield list can have a default except the final one since they all must be message fields. ...
python
def __parameter_default(self, final_subfield): """Returns default value of final subfield if it has one. If this subfield comes from a field list returned from __field_to_subfields, none of the fields in the subfield list can have a default except the final one since they all must be message fields. ...
Returns default value of final subfield if it has one. If this subfield comes from a field list returned from __field_to_subfields, none of the fields in the subfield list can have a default except the final one since they all must be message fields. Args: final_subfield: A simple field from the...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1626-L1644
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__parameter_enum
def __parameter_enum(self, final_subfield): """Returns enum descriptor of final subfield if it is an enum. An enum descriptor is a dictionary with keys as the names from the enum and each value is a dictionary with a single key "backendValue" and value equal to the same enum name used to stored it in t...
python
def __parameter_enum(self, final_subfield): """Returns enum descriptor of final subfield if it is an enum. An enum descriptor is a dictionary with keys as the names from the enum and each value is a dictionary with a single key "backendValue" and value equal to the same enum name used to stored it in t...
Returns enum descriptor of final subfield if it is an enum. An enum descriptor is a dictionary with keys as the names from the enum and each value is a dictionary with a single key "backendValue" and value equal to the same enum name used to stored it in the descriptor. The key "description" can also ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1646-L1667
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__parameter_descriptor
def __parameter_descriptor(self, subfield_list): """Creates descriptor for a parameter using the subfields that define it. Each parameter is defined by a list of fields, with all but the last being a message field and the final being a simple (non-message) field. Many of the fields in the descriptor a...
python
def __parameter_descriptor(self, subfield_list): """Creates descriptor for a parameter using the subfields that define it. Each parameter is defined by a list of fields, with all but the last being a message field and the final being a simple (non-message) field. Many of the fields in the descriptor a...
Creates descriptor for a parameter using the subfields that define it. Each parameter is defined by a list of fields, with all but the last being a message field and the final being a simple (non-message) field. Many of the fields in the descriptor are determined solely by the simple field at the end,...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1669-L1710
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__add_parameters_from_field
def __add_parameters_from_field(self, field, path_parameters, params, param_order): """Adds all parameters in a field to a method parameters descriptor. Simple fields will only have one parameter, but a message field 'x' that corresponds to a message class with fields 'y' ...
python
def __add_parameters_from_field(self, field, path_parameters, params, param_order): """Adds all parameters in a field to a method parameters descriptor. Simple fields will only have one parameter, but a message field 'x' that corresponds to a message class with fields 'y' ...
Adds all parameters in a field to a method parameters descriptor. Simple fields will only have one parameter, but a message field 'x' that corresponds to a message class with fields 'y' and 'z' will result in parameters 'x.y' and 'x.z', for example. The mapping from field to parameters is mostly handle...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1712-L1742
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__params_descriptor
def __params_descriptor(self, message_type, request_kind, path, method_id): """Describe the parameters of a method. If the message_type is not a ResourceContainer, will fall back to __params_descriptor_without_container (which will eventually be deprecated). If the message type is a ResourceContainer,...
python
def __params_descriptor(self, message_type, request_kind, path, method_id): """Describe the parameters of a method. If the message_type is not a ResourceContainer, will fall back to __params_descriptor_without_container (which will eventually be deprecated). If the message type is a ResourceContainer,...
Describe the parameters of a method. If the message_type is not a ResourceContainer, will fall back to __params_descriptor_without_container (which will eventually be deprecated). If the message type is a ResourceContainer, then all path/query parameters will come from the ResourceContainer This metho...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1779-L1829
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__request_message_descriptor
def __request_message_descriptor(self, request_kind, message_type, method_id, path): """Describes the parameters and body of the request. Args: request_kind: The type of request being made. message_type: messages.Message or ResourceContainer class. The message to ...
python
def __request_message_descriptor(self, request_kind, message_type, method_id, path): """Describes the parameters and body of the request. Args: request_kind: The type of request being made. message_type: messages.Message or ResourceContainer class. The message to ...
Describes the parameters and body of the request. Args: request_kind: The type of request being made. message_type: messages.Message or ResourceContainer class. The message to describe. method_id: string, Unique method identifier (e.g. 'myapi.items.method') path: string, HTTP path...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1831-L1871
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__method_descriptor
def __method_descriptor(self, service, method_info, rosy_method, protorpc_method_info): """Describes a method. Args: service: endpoints.Service, Implementation of the API as a service. method_info: _MethodInfo, Configuration for the method. rosy_method: string, Proto...
python
def __method_descriptor(self, service, method_info, rosy_method, protorpc_method_info): """Describes a method. Args: service: endpoints.Service, Implementation of the API as a service. method_info: _MethodInfo, Configuration for the method. rosy_method: string, Proto...
Describes a method. Args: service: endpoints.Service, Implementation of the API as a service. method_info: _MethodInfo, Configuration for the method. rosy_method: string, ProtoRPC method name prefixed with the name of the service. protorpc_method_info: protorpc.remote._RemoteMethodI...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1896-L1958
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__schema_descriptor
def __schema_descriptor(self, services): """Descriptor for the all the JSON Schema used. Args: services: List of protorpc.remote.Service instances implementing an api/version. Returns: Dictionary containing all the JSON Schema used in the service. """ methods_desc = {} for...
python
def __schema_descriptor(self, services): """Descriptor for the all the JSON Schema used. Args: services: List of protorpc.remote.Service instances implementing an api/version. Returns: Dictionary containing all the JSON Schema used in the service. """ methods_desc = {} for...
Descriptor for the all the JSON Schema used. Args: services: List of protorpc.remote.Service instances implementing an api/version. Returns: Dictionary containing all the JSON Schema used in the service.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L1960-L1999
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__get_merged_api_info
def __get_merged_api_info(self, services): """Builds a description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. Returns: The _ApiInfo object to use for the API that the given services implement. Raises: ApiConfigurationErr...
python
def __get_merged_api_info(self, services): """Builds a description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. Returns: The _ApiInfo object to use for the API that the given services implement. Raises: ApiConfigurationErr...
Builds a description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. Returns: The _ApiInfo object to use for the API that the given services implement. Raises: ApiConfigurationError: If there's something wrong with the API ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L2001-L2026
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__auth_descriptor
def __auth_descriptor(self, api_info): """Builds an auth descriptor from API info. Args: api_info: An _ApiInfo object. Returns: A dictionary with 'allowCookieAuth' and/or 'blockedRegions' keys. """ if api_info.auth is None: return None auth_descriptor = {} if api_info.au...
python
def __auth_descriptor(self, api_info): """Builds an auth descriptor from API info. Args: api_info: An _ApiInfo object. Returns: A dictionary with 'allowCookieAuth' and/or 'blockedRegions' keys. """ if api_info.auth is None: return None auth_descriptor = {} if api_info.au...
Builds an auth descriptor from API info. Args: api_info: An _ApiInfo object. Returns: A dictionary with 'allowCookieAuth' and/or 'blockedRegions' keys.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L2028-L2046
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__frontend_limit_descriptor
def __frontend_limit_descriptor(self, api_info): """Builds a frontend limit descriptor from API info. Args: api_info: An _ApiInfo object. Returns: A dictionary with frontend limit information. """ if api_info.frontend_limits is None: return None descriptor = {} for propn...
python
def __frontend_limit_descriptor(self, api_info): """Builds a frontend limit descriptor from API info. Args: api_info: An _ApiInfo object. Returns: A dictionary with frontend limit information. """ if api_info.frontend_limits is None: return None descriptor = {} for propn...
Builds a frontend limit descriptor from API info. Args: api_info: An _ApiInfo object. Returns: A dictionary with frontend limit information.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L2048-L2071
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__frontend_limit_rules_descriptor
def __frontend_limit_rules_descriptor(self, api_info): """Builds a frontend limit rules descriptor from API info. Args: api_info: An _ApiInfo object. Returns: A list of dictionaries with frontend limit rules information. """ if not api_info.frontend_limits.rules: return None ...
python
def __frontend_limit_rules_descriptor(self, api_info): """Builds a frontend limit rules descriptor from API info. Args: api_info: An _ApiInfo object. Returns: A list of dictionaries with frontend limit rules information. """ if not api_info.frontend_limits.rules: return None ...
Builds a frontend limit rules descriptor from API info. Args: api_info: An _ApiInfo object. Returns: A list of dictionaries with frontend limit rules information.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L2073-L2098
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.__api_descriptor
def __api_descriptor(self, services, hostname=None): """Builds a description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. ...
python
def __api_descriptor(self, services, hostname=None): """Builds a description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. ...
Builds a description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. Returns: A dictionary that can be deserialized int...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L2100-L2179
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.get_descriptor_defaults
def get_descriptor_defaults(self, api_info, hostname=None): """Gets a default configuration for a service. Args: api_info: _ApiInfo object for this service. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. Returns: A dicti...
python
def get_descriptor_defaults(self, api_info, hostname=None): """Gets a default configuration for a service. Args: api_info: _ApiInfo object for this service. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. Returns: A dicti...
Gets a default configuration for a service. Args: api_info: _ApiInfo object for this service. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. Returns: A dictionary with the default configuration.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L2181-L2224
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.get_config_dict
def get_config_dict(self, services, hostname=None): """JSON dict description of a protorpc.remote.Service in API format. Args: services: Either a single protorpc.remote.Service or a list of them that implements an api/version. hostname: string, Hostname of the API, to override the value set...
python
def get_config_dict(self, services, hostname=None): """JSON dict description of a protorpc.remote.Service in API format. Args: services: Either a single protorpc.remote.Service or a list of them that implements an api/version. hostname: string, Hostname of the API, to override the value set...
JSON dict description of a protorpc.remote.Service in API format. Args: services: Either a single protorpc.remote.Service or a list of them that implements an api/version. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. Ret...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L2226-L2246
cloudendpoints/endpoints-python
endpoints/api_config.py
ApiConfigGenerator.pretty_print_config_to_json
def pretty_print_config_to_json(self, services, hostname=None): """JSON string description of a protorpc.remote.Service in API format. Args: services: Either a single protorpc.remote.Service or a list of them that implements an api/version. hostname: string, Hostname of the API, to override...
python
def pretty_print_config_to_json(self, services, hostname=None): """JSON string description of a protorpc.remote.Service in API format. Args: services: Either a single protorpc.remote.Service or a list of them that implements an api/version. hostname: string, Hostname of the API, to override...
JSON string description of a protorpc.remote.Service in API format. Args: services: Either a single protorpc.remote.Service or a list of them that implements an api/version. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. R...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/api_config.py#L2248-L2262
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__field_to_parameter_type_and_format
def __field_to_parameter_type_and_format(self, field): """Converts the field variant type into a tuple describing the parameter. Args: field: An instance of a subclass of messages.Field. Returns: A tuple with the type and format of the field, respectively. Raises: TypeError: if the ...
python
def __field_to_parameter_type_and_format(self, field): """Converts the field variant type into a tuple describing the parameter. Args: field: An instance of a subclass of messages.Field. Returns: A tuple with the type and format of the field, respectively. Raises: TypeError: if the ...
Converts the field variant type into a tuple describing the parameter. Args: field: An instance of a subclass of messages.Field. Returns: A tuple with the type and format of the field, respectively. Raises: TypeError: if the field variant is a message variant.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L197-L218
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__parameter_default
def __parameter_default(self, field): """Returns default value of field if it has one. Args: field: A simple field. Returns: The default value of the field, if any exists, with the exception of an enum field, which will have its value cast to a string. """ if field.default: ...
python
def __parameter_default(self, field): """Returns default value of field if it has one. Args: field: A simple field. Returns: The default value of the field, if any exists, with the exception of an enum field, which will have its value cast to a string. """ if field.default: ...
Returns default value of field if it has one. Args: field: A simple field. Returns: The default value of the field, if any exists, with the exception of an enum field, which will have its value cast to a string.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L312-L330
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__parameter_enum
def __parameter_enum(self, param): """Returns enum descriptor of a parameter if it is an enum. An enum descriptor is a list of keys. Args: param: A simple field. Returns: The enum descriptor for the field, if it's an enum descriptor, else returns None. """ if isinstance(...
python
def __parameter_enum(self, param): """Returns enum descriptor of a parameter if it is an enum. An enum descriptor is a list of keys. Args: param: A simple field. Returns: The enum descriptor for the field, if it's an enum descriptor, else returns None. """ if isinstance(...
Returns enum descriptor of a parameter if it is an enum. An enum descriptor is a list of keys. Args: param: A simple field. Returns: The enum descriptor for the field, if it's an enum descriptor, else returns None.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L332-L346
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__parameter_descriptor
def __parameter_descriptor(self, param): """Creates descriptor for a parameter. Args: param: The parameter to be described. Returns: Dictionary containing a descriptor for the parameter. """ descriptor = {} param_type, param_format = self.__field_to_parameter_type_and_format(param...
python
def __parameter_descriptor(self, param): """Creates descriptor for a parameter. Args: param: The parameter to be described. Returns: Dictionary containing a descriptor for the parameter. """ descriptor = {} param_type, param_format = self.__field_to_parameter_type_and_format(param...
Creates descriptor for a parameter. Args: param: The parameter to be described. Returns: Dictionary containing a descriptor for the parameter.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L348-L389
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__add_parameter
def __add_parameter(self, param, path_parameters, params): """Adds all parameters in a field to a method parameters descriptor. Simple fields will only have one parameter, but a message field 'x' that corresponds to a message class with fields 'y' and 'z' will result in parameters 'x.y' and 'x.z', for ...
python
def __add_parameter(self, param, path_parameters, params): """Adds all parameters in a field to a method parameters descriptor. Simple fields will only have one parameter, but a message field 'x' that corresponds to a message class with fields 'y' and 'z' will result in parameters 'x.y' and 'x.z', for ...
Adds all parameters in a field to a method parameters descriptor. Simple fields will only have one parameter, but a message field 'x' that corresponds to a message class with fields 'y' and 'z' will result in parameters 'x.y' and 'x.z', for example. The mapping from field to parameters is mostly handle...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L391-L429
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__params_descriptor_without_container
def __params_descriptor_without_container(self, message_type, request_kind, path): """Describe parameters of a method which does not use a ResourceContainer. Makes sure that the path parameters are included in the message definition and adds any required fields a...
python
def __params_descriptor_without_container(self, message_type, request_kind, path): """Describe parameters of a method which does not use a ResourceContainer. Makes sure that the path parameters are included in the message definition and adds any required fields a...
Describe parameters of a method which does not use a ResourceContainer. Makes sure that the path parameters are included in the message definition and adds any required fields and URL query parameters. This method is to preserve backwards compatibility and will be removed in a future release. Arg...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L432-L459
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__params_descriptor
def __params_descriptor(self, message_type, request_kind, path, method_id, request_params_class): """Describe the parameters of a method. If the message_type is not a ResourceContainer, will fall back to __params_descriptor_without_container (which will eventually be deprecated). ...
python
def __params_descriptor(self, message_type, request_kind, path, method_id, request_params_class): """Describe the parameters of a method. If the message_type is not a ResourceContainer, will fall back to __params_descriptor_without_container (which will eventually be deprecated). ...
Describe the parameters of a method. If the message_type is not a ResourceContainer, will fall back to __params_descriptor_without_container (which will eventually be deprecated). If the message type is a ResourceContainer, then all path/query parameters will come from the ResourceContainer. This meth...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L461-L512
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__params_order_descriptor
def __params_order_descriptor(self, message_type, path, is_params_class=False): """Describe the order of path parameters. Args: message_type: messages.Message class, Message with parameters to describe. path: string, HTTP path to method. is_params_class: boolean, Whether the message represent...
python
def __params_order_descriptor(self, message_type, path, is_params_class=False): """Describe the order of path parameters. Args: message_type: messages.Message class, Message with parameters to describe. path: string, HTTP path to method. is_params_class: boolean, Whether the message represent...
Describe the order of path parameters. Args: message_type: messages.Message class, Message with parameters to describe. path: string, HTTP path to method. is_params_class: boolean, Whether the message represents URL parameters. Returns: Descriptor list for the parameter order.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L514-L545
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__schemas_descriptor
def __schemas_descriptor(self): """Describes the schemas section of the discovery document. Returns: Dictionary describing the schemas of the document. """ # Filter out any keys that aren't 'properties', 'type', or 'id' result = {} for schema_key, schema_value in self.__parser.schemas().i...
python
def __schemas_descriptor(self): """Describes the schemas section of the discovery document. Returns: Dictionary describing the schemas of the document. """ # Filter out any keys that aren't 'properties', 'type', or 'id' result = {} for schema_key, schema_value in self.__parser.schemas().i...
Describes the schemas section of the discovery document. Returns: Dictionary describing the schemas of the document.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L547-L591
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__request_message_descriptor
def __request_message_descriptor(self, request_kind, message_type, method_id, request_body_class): """Describes the parameters and body of the request. Args: request_kind: The type of request being made. message_type: messages.Message or ResourceContainer class. T...
python
def __request_message_descriptor(self, request_kind, message_type, method_id, request_body_class): """Describes the parameters and body of the request. Args: request_kind: The type of request being made. message_type: messages.Message or ResourceContainer class. T...
Describes the parameters and body of the request. Args: request_kind: The type of request being made. message_type: messages.Message or ResourceContainer class. The message to describe. method_id: string, Unique method identifier (e.g. 'myapi.items.method') request_body_class: mes...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L593-L621
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__method_descriptor
def __method_descriptor(self, service, method_info, protorpc_method_info): """Describes a method. Args: service: endpoints.Service, Implementation of the API as a service. method_info: _MethodInfo, Configuration for the method. protorpc_method_info: protorpc.remote._...
python
def __method_descriptor(self, service, method_info, protorpc_method_info): """Describes a method. Args: service: endpoints.Service, Implementation of the API as a service. method_info: _MethodInfo, Configuration for the method. protorpc_method_info: protorpc.remote._...
Describes a method. Args: service: endpoints.Service, Implementation of the API as a service. method_info: _MethodInfo, Configuration for the method. protorpc_method_info: protorpc.remote._RemoteMethodInfo, ProtoRPC description of the method. Returns: Dictionary describing the ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L641-L704
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__resource_descriptor
def __resource_descriptor(self, resource_path, methods): """Describes a resource. Args: resource_path: string, the path of the resource (e.g., 'entries.items') methods: list of tuples of type (endpoints.Service, protorpc.remote._RemoteMethodInfo), the methods that serve this resourc...
python
def __resource_descriptor(self, resource_path, methods): """Describes a resource. Args: resource_path: string, the path of the resource (e.g., 'entries.items') methods: list of tuples of type (endpoints.Service, protorpc.remote._RemoteMethodInfo), the methods that serve this resourc...
Describes a resource. Args: resource_path: string, the path of the resource (e.g., 'entries.items') methods: list of tuples of type (endpoints.Service, protorpc.remote._RemoteMethodInfo), the methods that serve this resource. Returns: Dictionary describing the resource.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L706-L766
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__get_merged_api_info
def __get_merged_api_info(self, services): """Builds a description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. Returns: The _ApiInfo object to use for the API that the given services implement. """ base_paths = sorted(set(s....
python
def __get_merged_api_info(self, services): """Builds a description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. Returns: The _ApiInfo object to use for the API that the given services implement. """ base_paths = sorted(set(s....
Builds a description of an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. Returns: The _ApiInfo object to use for the API that the given services implement.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L834-L853
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.__discovery_doc_descriptor
def __discovery_doc_descriptor(self, services, hostname=None): """Builds a discovery doc for an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the current service. Defaul...
python
def __discovery_doc_descriptor(self, services, hostname=None): """Builds a discovery doc for an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the current service. Defaul...
Builds a discovery doc for an API. Args: services: List of protorpc.remote.Service instances implementing an api/version. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. Returns: A dictionary that can be deserialized ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L855-L964
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.get_descriptor_defaults
def get_descriptor_defaults(self, api_info, hostname=None): """Gets a default configuration for a service. Args: api_info: _ApiInfo object for this service. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. Returns: A dicti...
python
def get_descriptor_defaults(self, api_info, hostname=None): """Gets a default configuration for a service. Args: api_info: _ApiInfo object for this service. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. Returns: A dicti...
Gets a default configuration for a service. Args: api_info: _ApiInfo object for this service. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. Returns: A dictionary with the default configuration.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L966-L1017
cloudendpoints/endpoints-python
endpoints/discovery_generator.py
DiscoveryGenerator.get_discovery_doc
def get_discovery_doc(self, services, hostname=None): """JSON dict description of a protorpc.remote.Service in discovery format. Args: services: Either a single protorpc.remote.Service or a list of them that implements an api/version. hostname: string, Hostname of the API, to override the v...
python
def get_discovery_doc(self, services, hostname=None): """JSON dict description of a protorpc.remote.Service in discovery format. Args: services: Either a single protorpc.remote.Service or a list of them that implements an api/version. hostname: string, Hostname of the API, to override the v...
JSON dict description of a protorpc.remote.Service in discovery format. Args: services: Either a single protorpc.remote.Service or a list of them that implements an api/version. hostname: string, Hostname of the API, to override the value set on the current service. Defaults to None. ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_generator.py#L1019-L1041
cloudendpoints/endpoints-python
endpoints/util.py
send_wsgi_response
def send_wsgi_response(status, headers, content, start_response, cors_handler=None): """Dump reformatted response to CGI start_response. This calls start_response and returns the response body. Args: status: A string containing the HTTP status code to send. headers: A list of (hea...
python
def send_wsgi_response(status, headers, content, start_response, cors_handler=None): """Dump reformatted response to CGI start_response. This calls start_response and returns the response body. Args: status: A string containing the HTTP status code to send. headers: A list of (hea...
Dump reformatted response to CGI start_response. This calls start_response and returns the response body. Args: status: A string containing the HTTP status code to send. headers: A list of (header, value) tuples, the headers to send in the response. content: A string containing the body content ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/util.py#L115-L143
cloudendpoints/endpoints-python
endpoints/util.py
get_headers_from_environ
def get_headers_from_environ(environ): """Get a wsgiref.headers.Headers object with headers from the environment. Headers in environ are prefixed with 'HTTP_', are all uppercase, and have had dashes replaced with underscores. This strips the HTTP_ prefix and changes underscores back to dashes before adding th...
python
def get_headers_from_environ(environ): """Get a wsgiref.headers.Headers object with headers from the environment. Headers in environ are prefixed with 'HTTP_', are all uppercase, and have had dashes replaced with underscores. This strips the HTTP_ prefix and changes underscores back to dashes before adding th...
Get a wsgiref.headers.Headers object with headers from the environment. Headers in environ are prefixed with 'HTTP_', are all uppercase, and have had dashes replaced with underscores. This strips the HTTP_ prefix and changes underscores back to dashes before adding them to the returned set of headers. Args...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/util.py#L146-L168
cloudendpoints/endpoints-python
endpoints/util.py
put_headers_in_environ
def put_headers_in_environ(headers, environ): """Given a list of headers, put them into environ based on PEP-333. This converts headers to uppercase, prefixes them with 'HTTP_', and converts dashes to underscores before adding them to the environ dict. Args: headers: A list of (header, value) tuples. The...
python
def put_headers_in_environ(headers, environ): """Given a list of headers, put them into environ based on PEP-333. This converts headers to uppercase, prefixes them with 'HTTP_', and converts dashes to underscores before adding them to the environ dict. Args: headers: A list of (header, value) tuples. The...
Given a list of headers, put them into environ based on PEP-333. This converts headers to uppercase, prefixes them with 'HTTP_', and converts dashes to underscores before adding them to the environ dict. Args: headers: A list of (header, value) tuples. The HTTP headers to add to the environment. ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/util.py#L171-L183
cloudendpoints/endpoints-python
endpoints/util.py
get_hostname_prefix
def get_hostname_prefix(): """Returns the hostname prefix of a running Endpoints service. The prefix is the portion of the hostname that comes before the API name. For example, if a non-default version and a non-default service are in use, the returned result would be '{VERSION}-dot-{SERVICE}-'. Returns: ...
python
def get_hostname_prefix(): """Returns the hostname prefix of a running Endpoints service. The prefix is the portion of the hostname that comes before the API name. For example, if a non-default version and a non-default service are in use, the returned result would be '{VERSION}-dot-{SERVICE}-'. Returns: ...
Returns the hostname prefix of a running Endpoints service. The prefix is the portion of the hostname that comes before the API name. For example, if a non-default version and a non-default service are in use, the returned result would be '{VERSION}-dot-{SERVICE}-'. Returns: str, the hostname prefix.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/util.py#L200-L228
cloudendpoints/endpoints-python
endpoints/util.py
get_app_hostname
def get_app_hostname(): """Return hostname of a running Endpoints service. Returns hostname of an running Endpoints API. It can be 1) "localhost:PORT" if running on development server, or 2) "app_id.appspot.com" if running on external app engine prod, or "app_id.googleplex.com" if running as Google first-par...
python
def get_app_hostname(): """Return hostname of a running Endpoints service. Returns hostname of an running Endpoints API. It can be 1) "localhost:PORT" if running on development server, or 2) "app_id.appspot.com" if running on external app engine prod, or "app_id.googleplex.com" if running as Google first-par...
Return hostname of a running Endpoints service. Returns hostname of an running Endpoints API. It can be 1) "localhost:PORT" if running on development server, or 2) "app_id.appspot.com" if running on external app engine prod, or "app_id.googleplex.com" if running as Google first-party Endpoints API, or 4) None ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/util.py#L231-L259
cloudendpoints/endpoints-python
endpoints/util.py
check_list_type
def check_list_type(objects, allowed_type, name, allow_none=True): """Verify that objects in list are of the allowed type or raise TypeError. Args: objects: The list of objects to check. allowed_type: The allowed type of items in 'settings'. name: Name of the list of objects, added to the exception. ...
python
def check_list_type(objects, allowed_type, name, allow_none=True): """Verify that objects in list are of the allowed type or raise TypeError. Args: objects: The list of objects to check. allowed_type: The allowed type of items in 'settings'. name: Name of the list of objects, added to the exception. ...
Verify that objects in list are of the allowed type or raise TypeError. Args: objects: The list of objects to check. allowed_type: The allowed type of items in 'settings'. name: Name of the list of objects, added to the exception. allow_none: If set, None is also allowed. Raises: TypeError: if...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/util.py#L262-L287
cloudendpoints/endpoints-python
endpoints/util.py
snake_case_to_headless_camel_case
def snake_case_to_headless_camel_case(snake_string): """Convert snake_case to headlessCamelCase. Args: snake_string: The string to be converted. Returns: The input string converted to headlessCamelCase. """ return ''.join([snake_string.split('_')[0]] + list(sub_string.capitalize() ...
python
def snake_case_to_headless_camel_case(snake_string): """Convert snake_case to headlessCamelCase. Args: snake_string: The string to be converted. Returns: The input string converted to headlessCamelCase. """ return ''.join([snake_string.split('_')[0]] + list(sub_string.capitalize() ...
Convert snake_case to headlessCamelCase. Args: snake_string: The string to be converted. Returns: The input string converted to headlessCamelCase.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/util.py#L290-L300
cloudendpoints/endpoints-python
endpoints/util.py
StartResponseProxy.Proxy
def Proxy(self, status, headers, exc_info=None): """Save args, defer start_response until response body is parsed. Create output buffer for body to be written into. Note: this is not quite WSGI compliant: The body should come back as an iterator returned from calling service_app() but instead, StartR...
python
def Proxy(self, status, headers, exc_info=None): """Save args, defer start_response until response body is parsed. Create output buffer for body to be written into. Note: this is not quite WSGI compliant: The body should come back as an iterator returned from calling service_app() but instead, StartR...
Save args, defer start_response until response body is parsed. Create output buffer for body to be written into. Note: this is not quite WSGI compliant: The body should come back as an iterator returned from calling service_app() but instead, StartResponse returns a writer that will be later called...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/util.py#L44-L66
cloudendpoints/endpoints-python
endpoints/discovery_service.py
DiscoveryService._send_success_response
def _send_success_response(self, response, start_response): """Sends an HTTP 200 json success response. This calls start_response and returns the response body. Args: response: A string containing the response body to return. start_response: A function with semantics defined in PEP-333. R...
python
def _send_success_response(self, response, start_response): """Sends an HTTP 200 json success response. This calls start_response and returns the response body. Args: response: A string containing the response body to return. start_response: A function with semantics defined in PEP-333. R...
Sends an HTTP 200 json success response. This calls start_response and returns the response body. Args: response: A string containing the response body to return. start_response: A function with semantics defined in PEP-333. Returns: A string, the response body.
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_service.py#L82-L95
cloudendpoints/endpoints-python
endpoints/discovery_service.py
DiscoveryService._get_rest_doc
def _get_rest_doc(self, request, start_response): """Sends back HTTP response with API directory. This calls start_response and returns the response body. It will return the discovery doc for the requested api/version. Args: request: An ApiRequest, the transformed request sent to the Discovery ...
python
def _get_rest_doc(self, request, start_response): """Sends back HTTP response with API directory. This calls start_response and returns the response body. It will return the discovery doc for the requested api/version. Args: request: An ApiRequest, the transformed request sent to the Discovery ...
Sends back HTTP response with API directory. This calls start_response and returns the response body. It will return the discovery doc for the requested api/version. Args: request: An ApiRequest, the transformed request sent to the Discovery API. start_response: A function with semantics defi...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_service.py#L97-L122
cloudendpoints/endpoints-python
endpoints/discovery_service.py
DiscoveryService._generate_api_config_with_root
def _generate_api_config_with_root(self, request): """Generate an API config with a specific root hostname. This uses the backend object and the ApiConfigGenerator to create an API config specific to the hostname of the incoming request. This allows for flexible API configs for non-standard environment...
python
def _generate_api_config_with_root(self, request): """Generate an API config with a specific root hostname. This uses the backend object and the ApiConfigGenerator to create an API config specific to the hostname of the incoming request. This allows for flexible API configs for non-standard environment...
Generate an API config with a specific root hostname. This uses the backend object and the ApiConfigGenerator to create an API config specific to the hostname of the incoming request. This allows for flexible API configs for non-standard environments, such as localhost. Args: request: An ApiRequ...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_service.py#L124-L158
cloudendpoints/endpoints-python
endpoints/discovery_service.py
DiscoveryService._list
def _list(self, request, start_response): """Sends HTTP response containing the API directory. This calls start_response and returns the response body. Args: request: An ApiRequest, the transformed request sent to the Discovery API. start_response: A function with semantics defined in PEP-333....
python
def _list(self, request, start_response): """Sends HTTP response containing the API directory. This calls start_response and returns the response body. Args: request: An ApiRequest, the transformed request sent to the Discovery API. start_response: A function with semantics defined in PEP-333....
Sends HTTP response containing the API directory. This calls start_response and returns the response body. Args: request: An ApiRequest, the transformed request sent to the Discovery API. start_response: A function with semantics defined in PEP-333. Returns: A string containing the resp...
https://github.com/cloudendpoints/endpoints-python/blob/00dd7c7a52a9ee39d5923191c2604b8eafdb3f24/endpoints/discovery_service.py#L170-L193