Issue 642 in gdata-python-client: AppsClient for Provisioning API has no exposed attributes for AppsForYourDomain exceptions

17 views
Skip to first unread message

gdata-pyt...@googlecode.com

unread,
Oct 16, 2012, 8:47:53 PM10/16/12
to gdata-python-client-...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 642 by jf...@yelp.com: AppsClient for Provisioning API has no
exposed attributes for AppsForYourDomain exceptions
http://code.google.com/p/gdata-python-client/issues/detail?id=642

*What steps will reproduce the problem?*
1. Trigger an AppsForYourDomain error, e.g.:

apps_client = gdata.apps.client.AppsClient(domain=DOMAIN)
apps_client.ClientLogin(email=email, password=password, source='apps')
user_entry = apps_client.RetrieveUser("nonexistentuser")

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.6/gdata/apps/client.py", line 106, in
RetrieveUser
return self.GetEntry(uri, desired_class=gdata.apps.data.UserEntry)
File "/usr/lib/pymodules/python2.6/gdata/client.py", line 652, in
get_entry
desired_class=desired_class, **kwargs)
File "/usr/lib/pymodules/python2.6/gdata/client.py", line 319, in request
RequestError)
gdata.client.RequestError: Server responded with: 400, <?xml version="1.0"
encoding="UTF-8"?>
<AppsForYourDomainErrors>
<error errorCode="1301" invalidInput="nonexistentuser"
reason="EntityDoesNotExist" />
</AppsForYourDomainErrors>


*What is the expected output?*
An exception with relevant attributes exposed to the python library in some
way, e.g.:

try:
user_entry = apps_client.RetrieveUser("nonexistentuser")
except gdata.client.AppsForYourDomainException, e:
print "Error %d, %s: %s" % (e.errorCode, e.reason, e.invalidInput)


*What version of the product are you using?*
2.0.17

*Please provide any additional information below.*
gdata.apps.service.AppsService contains an AppsForYourDomainException,
however the relevant attributes are similarly hidden solely in the 'body'
property of the exception:
gdata.apps.service.AppsForYourDomainException: {'status':
400, 'body': '<?xml version="1.0"
encoding="UTF-8"?>\r\n<AppsForYourDomainErrors>\r\n <error
errorCode="1301" invalidInput="nonexistentuser" reason="EntityDoesNotExist"
/>\r\n</AppsForYourDomainErrors>\r\n\r\n', 'reason': 'Bad Request'}

*Workaround*:

errxml = atom.core.parse(e.body)
errtype = errxml.tag
erratts = errxml.GetElements(tag='error')[0].attributes
print "Error %s, %s: %s" % (erratts['errorCode'], erratts['reason'],
erratts['invalidInput'])

gdata-pyt...@googlecode.com

unread,
Feb 8, 2013, 8:52:33 AM2/8/13
to gdata-python-client-...@googlegroups.com

Comment #1 on issue 642 by rie...@squishypuppy.com: AppsClient for
Provisioning API has no exposed attributes for AppsForYourDomain exceptions
http://code.google.com/p/gdata-python-client/issues/detail?id=642

Thank you for the workaround!

Reply all
Reply to author
Forward
0 new messages