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.

google.appengine.api.backends.backends module

Summary

Backends API.

Deprecated since version 1.9.1: Use Modules library instead.

This API provides utility methods for working with backends.

Contents

exception google.appengine.api.backends.backends.DefaultHostnameErrorsource

Bases: google.appengine.api.backends.backends.Error

Raised if no default hostname is set in the environment.

exception google.appengine.api.backends.backends.Errorsource

Bases: exceptions.Exception

Base class for exceptions in this module.

exception google.appengine.api.backends.backends.InvalidBackendErrorsource

Bases: google.appengine.api.backends.backends.Error

Raised if an invalid backend was provided.

exception google.appengine.api.backends.backends.InvalidInstanceErrorsource

Bases: google.appengine.api.backends.backends.Error

Raised if an invalid instance was provided.

google.appengine.api.backends.backends.get_backend()source

DEPRECATED: Get the name of the backend handling this request.

Warning: This API is deprecated and will be removed in a future release. Please migrate to the Modules API as soon as possible.

Returns

The current backend, or None if this is not a backend.

Return type

string

google.appengine.api.backends.backends.get_hostname(backend=None, instance=None)source

DEPRECATED: Returns the hostname for a backend or backend instance.

Warning: This API is deprecated and will be removed in a future release. Please migrate to the Modules API as soon as possible.

Parameters
  • backend – The name of the backend. If None, the current backend will be used.

  • instance – An optoinal instance number. If provided, the hostname will represent the specific instance. If absent, the hostname will represent the backend as a whole.

RaisesReturns

The hostname of the backend or backend instance.

google.appengine.api.backends.backends.get_instance()source

DEPRECATED: Get the instance number of the backend handling this request.

Warning: This API is deprecated and will be removed in a future release. Please migrate to the Modules API as soon as possible.

Returns

The instance, in [0, instances-1], or None if this is not a backend.

Return type

int

google.appengine.api.backends.backends.get_url(backend=None, instance=None, protocol='http')source

DEPRECATED: Returns a URL pointing to a backend or backend instance.

Warning: This API is deprecated and will be removed in a future release. Please migrate to the Modules API as soon as possible.

This method works in both production and development environments.

Parameters
  • backend – The name of the backend. If None, the current backend will be used.

  • instance – An optoinal instance number. If provided, the URL will target the specific instance. If absent, the URL will point to a load-balancing hostname for the backend.

  • protocol – The protocol to use (default=’http’).

RaisesReturns

The URL of the backend or backend instance.

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.