Hi Mike, This is a Python sample code that retrieves all groups for a Google Apps domain:
import gdata.apps.groups.service service = gdata.apps.groups.service.GroupsService(email='[email protected]', domain='EXAMPLE.COM', password='MY_PASSWORD') service.ProgrammaticLogin() service.RetrieveAllGroups() Please check the documentation for further issues with the Python client library for the Provisioning API: http://code.google.com/googleapps/domain/gdata_provisioning_api_v2.0_reference_python.html Claudio On Mon, May 9, 2011 at 9:20 AM, Mike Edwards <[email protected]> wrote: > I'm still struggling this from the Python side. Can anyone help me > out with the authentication process? I used something similar to the > above to retrieve a list of docs, and it worked fine, but I can't > understand why this is failing. > > On May 4, 5:20 pm, Mike Edwards <[email protected]> wrote: > > OK, thanks for that info. Processing via curl worked, so that leads > > me to believe it is not a problem on the Apps side, at least. > > > > On May 4, 4:00 pm, Claudio Cherubino <[email protected]> wrote: > > > > > > > > > > > > > > > > > Mike, > > > > > The service parameter in your cURL request is wrong, if you want to > retrieve > > > an Auth token for the Provisioning API its value should be "apps", not > > > "lh2". > > > Please trying using the following format: > > > > > curlhttps://www.google.com/accounts/ClientLogin--requestPOST -d Email= > > > [email protected] -d Passwd=YOURPASSWORD -d accountType=HOSTED -d > > > service=apps > > > > > Thanks > > > Claudio > > > > > On Wed, May 4, 2011 at 7:27 PM, Mike Edwards <[email protected]> > wrote: > > > > Hmmm. I've used curl before, but not with Apps. I'm trying to > follow > > > >http://code.google.com/apis/gdata/articles/using_cURL.htmlbutkeep > > > > getting an "Invalid Token" despite running the ClientLogin URL first, > > > > and then the one with the Authorization header. (My Auth token from > > > > the first step is much longer than the example and is different every > > > > time I run it.) > > > > > > curlhttps://apps-apis.google.com/accounts/ClientLogin--data- > > > > urlencode [email protected] --data-urlencode Passwd=secret -d > > > > accountType=GOOGLE -d source=Google-cURL-test -d service=lh2 > > > > curl --silent --header "Authorization: GoogleLogin > > > > Auth=very_long_string" " > https://apps-apis.google.com/a/feeds/group/2.0/ > > > > mydomain.com < > https://apps-apis.google.com/a/feeds/group/2.0/mydomain.com> > > > > " > > > > > > Here's the error from the python test I ran: > > > > > > Traceback (most recent call last): > > > > File "groups.py", line 8, in <module> > > > > client.RetrieveAllGroups() > > > > File "/usr/lib/python2.6/site-packages/gdata/apps/groups/ > > > > service.py", line 164, in RetrieveAllGroups > > > > return self._GetPropertiesList(uri) > > > > File "/usr/lib/python2.6/site-packages/gdata/apps/service.py", line > > > > 510, in _GetPropertiesList > > > > property_feed = self._GetPropertyFeed(uri) > > > > File "/usr/lib/python2.6/site-packages/gdata/apps/service.py", line > > > > 507, in _GetPropertyFeed > > > > raise gdata.apps.service.AppsForYourDomainException(e.args[0]) > > > > gdata.apps.service.AppsForYourDomainException: {'status': 403, > 'body': > > > > '<HTML>\n<HEAD>\n<TITLE>Invalid domain.</TITLE>\n</HEAD>\n<BODY > > > > BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Invalid > domain.</H1>\n<H2>Error > > > > 403</H2>\n</BODY>\n</HTML>\n', 'reason': 'Invalid domain.'} > > > > > > Mike > > > > > > On May 4, 11:21 am, Claudio Cherubino <[email protected]> wrote: > > > > > Can you please try performing the same request with cURL? > > > > > > > > http://code.google.com/googleapps/domain/gdata_provisioning_api_v2.0_... > > > > > > > Also, the complete error can definitely help. > > > > > Thanks > > > > > > > Claudio > > > > > > > On Wed, May 4, 2011 at 5:15 PM, Mike Edwards <[email protected] > > > > > > wrote: > > > > > > Apps for Business. I had a head-slap moment and realized I > hadn't > > > > > > enabled the provisioning API, but even with that switched on, I > get > > > > > > the same error. > > > > > > > > I have successfully retrieved a list of documents with > > > > > > GetDocumentListFeed, so I think Python and the gdata modules are > > > > > > installed properly. > > > > > > > > Thanks, > > > > > > Mike > > > > > > > > On May 4, 8:34 am, Claudio Cherubino <[email protected]> > wrote: > > > > > > > Hi Mike, > > > > > > > > > What is the edition of your Google Apps domain? > > > > > > > Please note that the Provisioning API is available for > read/write > > > > access > > > > > > in > > > > > > > Google Apps for Business, Education and ISPs and available in > all > > > > Google > > > > > > > Apps versions for read-only access by Apps Marketplace > applications: > > > > > > > http://code.google.com/googleapps/domain/gdata_provisioning_api_v2.0_... > > > > > > > > > Claudio > > > > > > > > > On Wed, May 4, 2011 at 2:24 PM, Mike Edwards < > [email protected]> > > > > > > wrote: > > > > > > > > My apologies if this isn't the correct place for this post, > but I > > > > am > > > > > > > > working with the Python gdata library but have run into an > error. > > > > I > > > > > > > > am migrating my users to Google Apps and my ultimate goal is > to > > > > create > > > > > > > > about a hundred groups and don't want to do it by hand. In > testing > > > > > > > > out the use of the python library, I tried the following: > > > > > > > > > > import gdata.apps.groups.service > > > > > > > > client = gdata.apps.groups.service.GroupsService() > > > > > > > > client.ClientLogin('[email protected]', 'password') > > > > > > > > client.RetrieveAllGroups() > > > > > > > > > > But that throws an Error 403 Invalid domain. (Obviously, I > used my > > > > > > > > admin user ID so the domain is indeed valid. I can post the > whole > > > > > > > > error if someone cares.) > > > > > > > > > > Can anyone throw me a clue here? And if there's a better > group or > > > > > > > > forum for this question, I will be happy to take it there. > > > > > > > > > > Thanks, > > > > > > > > Mike > > > > > > > > > > -- > > > > > > > > You received this message because you are subscribed to the > Google > > > > > > Groups > > > > > > > > "Google Apps Domain Information and Management APIs" group. > > > > > > > > To post to this group, send email to > > > > > > > > [email protected]. > > > > > > > > To unsubscribe from this group, send email to > > > > > > > > [email protected]. > > > > > > > > For more options, visit this group at > > > > > > > >http://groups.google.com/group/google-apps-mgmt-apis?hl=en. > > > > > > > > -- > > > > > > You received this message because you are subscribed to the > Google > > > > Groups > > > > > > "Google Apps Domain Information and Management APIs" group. > > > > > > To post to this group, send email to > > > > > > [email protected]. > > > > > > To unsubscribe from this group, send email to > > > > > > [email protected]. > > > > > > For more options, visit this group at > > > > > >http://groups.google.com/group/google-apps-mgmt-apis?hl=en. > > > > > > -- > > > > You received this message because you are subscribed to the Google > Groups > > > > "Google Apps Domain Information and Management APIs" group. > > > > To post to this group, send email to > > > > [email protected]. > > > > To unsubscribe from this group, send email to > > > > [email protected]. > > > > For more options, visit this group at > > > >http://groups.google.com/group/google-apps-mgmt-apis?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Google Apps Domain Information and Management APIs" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-apps-mgmt-apis?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Apps Domain Information and Management APIs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-apps-mgmt-apis?hl=en.
