class documentation
class BaseModel(Model):
Known subclasses: googleapiclient.model.JsonModel, googleapiclient.model.ProtocolBufferModel
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 |
The value to supply as the "alt" query parameter for requests. |
| Instance Variable | content |
The value to use for the HTTP Content-type header. |
| Instance Variable | no |
The value to return when deserializing a 204 "No Content" response. |
| Method | _build |
Builds a query string. |
| Method | _log |
Logs debugging information about the request if requested. |
| Method | _log |
Logs debugging information about the response if requested. |
Perform the actual deserialization from response string to Python object.
| Parameters | |
| content | string, the body of the HTTP response |
| Returns | |
| The body de-serialized as a Python object. | |
overrides
googleapiclient.model.Model.requestUpdates outgoing requests with a serialized body.
| Parameters | |
| headers | dict, request headers |
| path | dict, parameters that appear in the request path |
| query | dict, parameters that appear in the query |
| body | object, 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 |
overrides
googleapiclient.model.Model.responseConvert the response wire format into a Python object.
| Parameters | |
| resp | httplib2.Response, the HTTP response headers and status |
| content | string, 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. | |
Perform the actual Python object serialization.
| Parameters | |
| body | object, the request body as a Python object. |
| Returns | |
| string, the body in serialized form. | |
Builds a query string.
| Parameters | |
| params | dict, the query parameters |
| Returns | |
| The query parameters properly encoded into an HTTP URI query string. | |