class documentation

Base model class.

Subclasses should provide implementations for the "serialize" and "deserialize" methods, as well as values for the following class attributes.

Method deserialize Perform the actual deserialization from response string to Python object.
Method request Updates outgoing requests with a serialized body.
Method response Convert the response wire format into a Python object.
Method serialize Perform the actual Python object serialization.
Instance Variable accept The value to use for the HTTP Accept header.
Instance Variable alt_param The value to supply as the "alt" query parameter for requests.
Instance Variable content_type The value to use for the HTTP Content-type header.
Instance Variable no_content_response The value to return when deserializing a 204 "No Content" response.
Method _build_query Builds a query string.
Method _log_request Logs debugging information about the request if requested.
Method _log_response Logs debugging information about the response if requested.
def deserialize(self, content):

Perform the actual deserialization from response string to Python object.

Parameters
contentstring, the body of the HTTP response
Returns
The body de-serialized as a Python object.
def request(self, headers, path_params, query_params, body_value):

Updates outgoing requests with a serialized body.

Parameters
headersdict, request headers
path_paramsdict, parameters that appear in the request path
query_paramsdict, parameters that appear in the query
body_valueobject, the request body as a Python object, which must be serializable by json.
Returns
A tuple of (headers, path_params, query, body)headers: dict, request headers path_params: dict, parameters that appear in the request path query: string, query part of the request URI body: string, the body serialized as JSON
def response(self, resp, content):

Convert the response wire format into a Python object.

Parameters
resphttplib2.Response, the HTTP response headers and status
contentstring, the body of the HTTP response
Returns
The body de-serialized as a Python object.
Raises
googleapiclient.errors.HttpError if a non 2xx response is received.
def serialize(self, body_value):

Perform the actual Python object serialization.

Parameters
body_valueobject, the request body as a Python object.
Returns
string, the body in serialized form.
accept =

The value to use for the HTTP Accept header.

alt_param =

The value to supply as the "alt" query parameter for requests.

content_type =

The value to use for the HTTP Content-type header.

no_content_response =

The value to return when deserializing a 204 "No Content" response.

def _build_query(self, params):

Builds a query string.

Parameters
paramsdict, the query parameters
Returns
The query parameters properly encoded into an HTTP URI query string.
def _log_request(self, headers, path_params, query, body):

Logs debugging information about the request if requested.

def _log_response(self, resp, content):

Logs debugging information about the response if requested.