Using the Google Docs API, I am trying to create new docs and also provide a list of all current documents in a specific folder in my Google Docs. I start with python development, so I'm a little rough around the edges.
Things I'm trying to do:
- Create a collection (or folder) named [Folder Name] ONLY if that name does not already exist
- Create a document inside [Folder Name]
- Only from [Folder Name] get a list of documents along with links to the documents themselves
I believe that I am using the Google Docs API 3.0 and using the gdata-2.0.16 helper for python.
Code so far:
import gdata.docs.data
import gdata.docs.client
class SampleConfig (object):
APP_NAME = 'GDataDocumentsListAPISample-v1.0'
DEBUG = False
client = gdata.docs.client.DocsClient ()
client.ClientLogin ('[email_address]', '[password]', source = SampleConfig.APP_NAME)
col = gdata.docs.data.Resource (type = 'folder', title = 'Folder Name')
col = client.CreateResource (col)
doc = gdata.docs.data.Resource (type = 'document', title = 'I did this')
doc = client.CreateResource (doc, collection = col)
So, now to the questions: where am I hopelessly stuck:
- How to check if [folder name] exists?
- How to get contents ONLY [Folder Name]?
- How can I get absolute links to all the documents that I create in this folder?
I know that I am far from complete here, but any help or advice you could give would be wonderful.
Thanks in advance!
source
share