Python google.appengine.api.apiproxy_stub_map() Examples

The following are code examples for showing how to use google.appengine.api.apiproxy_stub_map(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: python-compat-runtime   Author: GoogleCloudPlatform   File: __init__.py    Apache License 2.0 6 votes vote down vote up
def __init__(self, package, capabilities=None, methods=None,
               stub_map=apiproxy_stub_map):
    """Constructor.

    Args:
      capabilities: List of strings
      methods: List of strings
    """
    if capabilities is None:
      capabilities = []
    if methods is None:
      methods = []
    self._package = package
    self._capabilities = ['*'] + capabilities
    self._methods = methods
    self._stub_map = stub_map 
Example 2
Project: python-compat-runtime   Author: GoogleCloudPlatform   File: recording.py    Apache License 2.0 6 votes vote down vote up
def pre_call_hook(service, call, request, response, rpc=None):
  """Pre-Call hook function for apiprixy_stub_map.

  The signature is determined by the CallHooks protocol.  In certain
  cases, rpc may be omitted.

  Once registered, this fuction will be called right before any kind
  of RPC call is made through apiproxy_stub_map.  The arguments are
  passed on to the record_rpc_request() method of the global
  'recorder_proxy' variable, unless the latter does not have a Recorder set
  for this request.
  """
  if recorder_proxy.has_recorder_for_current_request():
    if config.DEBUG:
      logging.debug('pre_call_hook: recording %s.%s', service, call)
    recorder_proxy.record_rpc_request(service, call, request, response, rpc) 
Example 3
Project: python-compat-runtime   Author: GoogleCloudPlatform   File: recording.py    Apache License 2.0 6 votes vote down vote up
def post_call_hook(service, call, request, response, rpc=None, error=None):
  """Post-Call hook function for apiproxy_stub_map.

  The signature is determined by the CallHooks protocol.  In certain
  cases, rpc and/or error may be omitted.

  Once registered, this fuction will be called right after any kind of
  RPC call made through apiproxy_stub_map returns.  The call is passed
  on to the record_rpc_request() method of the global 'recorder_proxy'
  variable, unless the latter does not have a Recorder set for this
  request.
  """

  if recorder_proxy.has_recorder_for_current_request():
    if config.DEBUG:
      logging.debug('post_call_hook: recording %s.%s', service, call)
    recorder_proxy.record_rpc_response(service, call, request, response, rpc)