Resources may be fetched individually or as feeds.
Contents
To retrieve a list of feeds, use the gdata.docs.client.GetResources() method, for example:
resource_feed = client.GetResources()
The return value is an instance of gdata.docs.data.ResourceFeed, and individual entries can be accessed in the entry attribute.
Mostly, all resources will not be available in a single request, and for this purpose, the next page of results should be fetched. The URI for the next page is available as the gdata.docs.data.ResourceFeed.GetNextLink() method, and can be used as:
resource_feed = client.GetResources()
nextpage_feed = client.GetResources(uri=resource_feed.GetNextLink().href)
Paging through the entire set of resources is handled using the convenience method gdata.docs.client.GetAllResources() method.:
all_entries = client.GetAllResources()
This returns a list of entries (not a feed) and takes care of paging the individual feeds and collecting the results.
An entry can be retrieved again if you have an gdata.docs.data.Resource instance, or by fetching it from its resource id.
To refetch a resource, use gdata.docs.client.GetResource() method, like so:
# First fetch the entry as the first entry in a feed
entry = client.GetResources().entry[0]
# Refetch the entry sometime later
refetched_entry = client.GetResource(entry)
If a resource id is known, this can be used to fetch an entry, using the py:meth:gdata.docs.client.GetResourceById method, line so:
resource_id = 'AB56C6D8E9AB56C6D8E9AB56C6D8E9AB56C6D8E9'
entry = client.GetResourceById(resource_id)