Package googleapiclient :: Module model
[hide private]
[frames] | no frames]

Module model

source code

Model objects for requests and responses.

Each API may support one or more serializations, such
as JSON, Atom, etc. The model classes are responsible
for converting between the wire format and the Python
object representation.


Author: jcgregorio@google.com (Joe Gregorio)

Classes [hide private]
  Model
Model base class.
  BaseModel
Base model class.
  JsonModel
Model class for JSON.
  RawModel
Model class for requests that don't return JSON.
  MediaModel
Model class for requests that return Media.
  ProtocolBufferModel
Model class for protocol buffers.
Functions [hide private]
 
_abstract() source code
 
makepatch(original, modified)
Create a patch object.
source code
Variables [hide private]
  LOGGER = logging.getLogger(__name__)
  dump_request_response = False
Function Details [hide private]

makepatch(original, modified)

source code 
Create a patch object.

Some methods support PATCH, an efficient way to send updates to a resource.
This method allows the easy construction of patch bodies by looking at the
differences between a resource before and after it was modified.

Args:
  original: object, the original deserialized resource
  modified: object, the modified deserialized resource
Returns:
  An object that contains only the changes from original to modified, in a
  form suitable to pass to a PATCH method.

Example usage:
  item = service.activities().get(postid=postid, userid=userid).execute()
  original = copy.deepcopy(item)
  item['object']['content'] = 'This is updated.'
  service.activities.patch(postid=postid, userid=userid,
    body=makepatch(original, item)).execute()