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.
Every is_enabled
request to this API always returns true
except for the "Datastore writes" capability, which
returns false
if Datastore is in read-only
mode for your app.
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:
from
google.appengine.api
import
capabilities
def
StoreUploadedProfileImage
(
self
):
uploaded_image
=
self
.
request
.
get
(
'img'
)
# If the images API is unavailable, we'll just skip the resize.
if
capabilities
.
CapabilitySet
(
'images'
)
.
is_enabled
():
uploaded_image
=
images
.
resize
(
uploaded_image
,
64
,
64
)
store
(
uploaded_image
)
Using the Capabilities API
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 the next section for a
list of services currently enabled in this API.
Supported capabilities
The API currently supports the following capabilities:
| Capability | Arguments to CapabilitySet
|
|---|---|
| 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"
|

