Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



Functions

The Backend API is deprecated as of March 13, 2014. Although Google will continue to support the Backend API in accordance with our terms of service , it is strongly recommended that all new applications use the Modules API instead.

This Backends API allows you to retrieve information about the backend handling the current request, and compute the URL and hostname of any other backend or backend instance within the same application. The methods in this API work in both production and the development server .

The google.appengine.api.backends package provides the following functions:

get_backend ()

Gets the name ( BACKEND_ID ) of the backend handling the current request. Returns None if the request is not handled by a backend.

get_hostname ( backend = None , instance = None )

Returns the hostname of the backend or backend instance.

backend = None
The optional backend name, a string. You can identify the name of a backend handling a request using get_backend() . Specifying backend=None returns the current backend; this is the default behavior.
instance = None
The optional backend instance id, an integer. You can identify the instance id using get_instance() . If provided, the hostname represents the specific instance. If absent, the hostname represents the backend as a whole. Raises the InvalidInstanceError if the instance id is not an integer.
get_instance ()

Gets the id ( INSTANCE_ID ) for the instance handling the current request. Returns the instance ID (numbering starts at 0 ), or None if the request is not handled by a backend.

get_url ( backend = None , instance = None , protocol = 'HTTP' )

Gets the address of a specific backend. Returns a local address if run in the development server, or a production address if run in production. Returns the HTTP or HTTPS address of a specific backend.

Arguments

backend = None
The optional backend name. You can identify the name of a backend handling a request using get_backend() . Specifying backend=None returns the current backend; this is the default behavior.
instance = None
The optional backend instance id, an integer. If provided, the URL targets the specific instance. If absent, the URL points to a load-balancing hostname for the backend. You can identify the instance id using get_instance() . Raises the InvalidInstanceError if the instance id is not an integer.
protocol = 'http'
The protocol to use, either HTTP (default) or HTTPS . The development server supports only HTTP . Production supports both HTTP and HTTPS . Raises the InvalidBackendError if the provided backend cannot be found.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.