Python 2.7 has reached end of support
and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Python 2.7
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Python
2.7 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of Python.
Stay organized with collections
Save and categorize content based on your preferences.
google.appengine.api.namespace_manager.namespace_manager module
Summary
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.
Contents
- exception google.appengine.api.namespace_manager.namespace_manager.BadValueErrorsource
-
Bases: exceptions.Exception
Raised by ValidateNamespaceString.
- google.appengine.api.namespace_manager.namespace_manager.set_namespace(namespace)source
Set the default namespace for the current HTTP request.
Parametersnamespace – A string naming the new namespace to use. A value of None
will unset the default namespace value.
- google.appengine.api.namespace_manager.namespace_manager.get_namespace()source
-
Get the current default namespace or (‘’) namespace if unset.
- google.appengine.api.namespace_manager.namespace_manager.google_apps_namespace()source
- google.appengine.api.namespace_manager.namespace_manager.enable_request_namespace()source
-
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}).
Parameters
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-16 UTC."],[[["This module allows you to control the namespacing system used by various APIs, including the ability to set a default namespace."],["The `set_namespace` function sets the default namespace for the current HTTP request, with the option to unset it by using `None`."],["The `get_namespace` function is used to retrieve the current default namespace, returning an empty string if it's unset."],["The `validate_namespace` function ensures a given string is a valid namespace, raising a `BadValueError` exception if it fails validation, and namespaces are limited to 100 characters and the regex `([0-9A-Za-z._-]{0,100})`."],["The `enable_request_namespace` function sets the namespace to the google apps domain for the current request, but is now deprecated in favor of lib_config."]]],[]]