Capabilities API for legacy bundled services Stay organized with collections Save and categorize content based on your preferences.
With the Capabilities API, your application can detect outages and scheduleddowntime for specificAPI capabilities. You can usethis API to reduce downtime in your application by detecting when a capabilityis unavailable and then bypassing it. .
This API is supported for first-generation runtimes and can be used whenupgrading to corresponding second-generation runtimes. If you are updating to the App Engine Python 3 runtime, refer to themigration guide to learn about your migration options for legacy bundled services.Everyis_enabled request to this API always returnstrue except for the "Datastore writes" capability, which returnsfalse if Datastore is in read-only mode for your app.
For example, if you use the Images API to resize images, you can use theCapabilities API to detect when the Images API is unavailable and skip theresize:
fromgoogle.appengine.apiimportcapabilitiesdefStoreUploadedProfileImage(self):uploaded_image=self.request.get('img')# If the images API is unavailable, we'll just skip the resize.ifcapabilities.CapabilitySet('images').is_enabled():uploaded_image=images.resize(uploaded_image,64,64)store(uploaded_image)The Datastore API provides a convenience wrapper for the Datastore read andwrite capabilities. While you can test capabilities simply by supplying thecapability name as an argument toCapabilitySet(), in this case you can alsouse thedb.READ_CAPABILITY anddb.WRITE_CAPABILITY convenienceCapabilitySet objects. The following sample shows how to detect theavailability of Datastore writes using a convenience wrapper and, duringdowntime, provide a message to users:
fromgoogle.appengine.extimportdbdefRenderHTMLForm(self):ifnotdb.WRITE_CAPABILITY.is_enabled():# Datastore is in read-only mode.Using the Capabilities API in Python 2
TheCapabilitySetclass defines all of theavailable methods for this API. You can either name capabilities explicitly orinfer them from the methods provided by this class. See below for thelist of services currently enabled in this API.
Supported capabilities
The API currently supports the following capabilities:
| Capability | Arguments toCapabilitySet |
|---|---|
| Availability of the blobstore | "blobstore" |
| Datastore reads | "datastore_v3" |
| Datastore writes | "datastore_v3", ["write"] |
| Availability of the Images service | "images" |
| Availability of the Mail service | "mail" |
| Availability of the Memcache service | "memcache" |
| Availability of the Task Queue service | "taskqueue" |
| Availability of the URL Fetch service | "urlfetch" |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.