Python 2 is no longer supported by the community. We recommend that you migrate Python 2 apps to Python 3.

google.appengine.api.namespace_manager.namespace_manager module


Control the namespacing system used by various APIs.

A namespace may be specified in various API calls exemplified by the datastore and memcache interfaces. The default can be specified using this module.


exception google.appengine.api.namespace_manager.namespace_manager.BadValueErrorsource

Bases: exceptions.Exception

Raised by ValidateNamespaceString.


Set the default namespace for the current HTTP request.


namespace – A string naming the new namespace to use. A value of None will unset the default namespace value.


Get the current default namespace or (‘’) namespace if unset.


Set the default namespace to the Google Apps domain referring this request.

This method is deprecated, use lib_config instead.

Calling this function will set the default namespace to the Google Apps domain that was used to create the url used for this request and only for the current request and only if the current default namespace is unset.

google.appengine.api.namespace_manager.namespace_manager.validate_namespace(value, exception=google.appengine.api.namespace_manager.namespace_manager.BadValueError)source

Raises an exception if value is not a valid Namespace string.

A namespace must match the regular expression ([0-9A-Za-z._-]{0,100}).

  • value – string, the value to validate.

  • exception – exception type to raise.