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.
With the Capabilities API, your application can detect outages and scheduled
downtime for specific API capabilities. You can use
this API to reduce downtime in your application by detecting when a capability
is unavailable and then bypassing it. .
For example, if you use the Images API to resize images, you can use the
Capabilities API to detect when the Images API is unavailable and skip the
resize:
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 and
write capabilities. While you can test capabilities simply by supplying the
capability name as an argument to CapabilitySet(), in this case you can also
use the db.READ_CAPABILITY and db.WRITE_CAPABILITY convenience
CapabilitySet objects. The following sample shows how to detect the
availability of Datastore writes using a convenience wrapper and, during
downtime, 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
The
CapabilitySet
class defines all of the
available methods for this API. You can either name capabilities explicitly or
infer them from the methods provided by this class. See below for the
list of services currently enabled in this API.
Supported capabilities
The API currently supports the following capabilities:
[[["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-08-04 UTC."],[[["The Capabilities API allows applications to detect outages and scheduled downtime for specific API capabilities, helping to reduce application downtime by bypassing unavailable features."],["This API supports first-generation runtimes and can be utilized when upgrading to corresponding second-generation runtimes, with specific migration guidance for the App Engine Python 3 runtime."],["While `is_enabled` generally returns `true`, the \"Datastore writes\" capability returns `false` if Datastore is in read-only mode."],["The API can be used by explicitly naming capabilities or by inferring them from the `CapabilitySet` class methods."],["The API currently supports capabilities like blobstore, Datastore reads and writes, Images, Mail, Memcache, Task Queue, and URL Fetch services."]]],[]]