Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products.

Python 3.10 is now generally available.


Base class for creating handlers that may send blobs to users.

Inherits From: expected_type



View source

Override this method to handle GET requests to this WSGI handler.

This method is called internally by call if an instance of this class is used as a WSGI callable app, and the HTTP request being handled is a GET request.

environ a WSGI dict describing the HTTP request (See PEP 333).

response a string containing body of the response
status HTTP status code of enum type http.HTTPStatus
headers a list of 2-tuples containing Response headers


View source

Get range from header if it exists.

A range header of "bytes: 0-100" would return (0, 100). Args: environ: a WSGI dict describing the HTTP request (See PEP 333). Returns: Tuple (start, end): start: Start index. None if there is None. end: End index (inclusive). None if there is None. None if there is no request header.

UnsupportedRangeFormatError If the range format in the header is valid, but not supported.
RangeFormatError If the range format in the header is not valid.


View source

Send a blob-response based on a blob_key.

Returns the correct response headers for serving a blob. If BlobInfo is provided and no content_type specified, will set request content type to BlobInfo's content type.

environ a WSGI dict describing the HTTP request (See PEP 333).
blob_key_or_info BlobKey or BlobInfo record to serve.
content_type Content-type header to override when known. If not set, this header is not included in the returned headers. Web frameworks might set the 'content-type' header to a default type, which prevents GAE from setting a guessed 'content-type'. This behavior can be bypassed by setting headers['content-type'] to None or an empty string explicitly after this function call.
save_as If True, and BlobInfo record is provided, use BlobInfos filename to save-as. If string is provided, use string as filename. If None or False, do not send as attachment.
start Start index of content-range to send.
end End index of content-range to send. End index is inclusive.
**kwargs The use_range keyworded argument provides content range from the requests' Range header.

ValueError on invalid save_as parameter.

headers a dict containing response headers


View source

Call self as a function.