AttributeError: 'DocsClient' object has no attribute 'GetDocumentListFeed'

349 Views Asked by At

I'm currently trying to build a Script that interacts with Google's API's, but I keep getting an Attribute error:

Traceback (most recent call last):
  File "service_catalog_automation.py", line 18, in <module>
    feed = client.GetDocumentListFeed()
AttributeError: 'DocsClient' object has no attribute 'GetDocumentListFeed'

This is the code I'm trying to use

import gdata.gauth
import gdata.docs.client
import sys

def sys_print(text):
    sys.stdout.write(str(text))
    sys.stdout.flush()

CONSUMER_KEY = 'domain.com'
CONSUMER_SECRET = 'abcde1234'
requestor_id = '[email protected]'

client = gdata.docs.client.DocsClient(source='my-script-v1')
client.auth_token = gdata.gauth.TwoLeggedOAuthHmacToken(
    CONSUMER_KEY, CONSUMER_SECRET, requestor_id)

# Retrieve user's list of Google Docs
feed = client.GetDocumentListFeed()
for entry in feed.entry:
    sys_print(entry.title.text)
    sys_print('\n')

I've pulled client.getDocumentListFeed() portion of code from their sample code here and have even tried a bare minimum approach using their sample code under the 2LeggedOAuth section here. (I also have tried GetDocList() from that example with the same error)

I have downloaded Google's gdata-python-client to a linux vm's home directory and installed it by running python setup.py install and ran the test python all_tests.py with no errors.

Any help would be greatly apperciated

1

There are 1 best solutions below

0
On

In the first example, they're assigning their client object as the return of gdata.docs.service.DocsService().

The second example also returns the client object as a DocsService type:

client = gdata.docs.service.DocsService(source='yourCompany-YourAppName-v1')

This would seem to imply that gd_client is of type DocsService, not DocsClient