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: (Joe Gregorio)

Classes [hide private]
Model base class.
Base model class.
Model class for JSON.
Model class for requests that don't return JSON.
Model class for requests that return Media.
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.

  original: object, the original deserialized resource
  modified: object, the modified deserialized resource
  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()