I've been studying these two samples I found in another post in this forum:
http://code.google.com/appengine/articles/gdata.html http://code.google.com/appengine/articles/more_google_data.html and trying to blend them with this example that creates a new empty spreadsheet: http://code.google.com/apis/documents/docs/1.0/developers_guide_python.html#CreatingAnEmptyDocument I'm running on Windows local app/dev/server. Unlike the first two sites above, I don't want to use the userid/pass of the guy logged on, I want to put a spreadsheet in our special admin account, then perhaps share it with another a third user. My logon seems to run okay. If I put a bad password, I get this error "BadAuthentication: Incorrect username or password" On the client.ProgrammaticLogin()) which is what I would expect. ----------------------------------------------------------------------------------------- CODE: ----------------------------------------------------------------------------------------- class TestGDocAPI(webapp.RequestHandler): def get(self): client = gdata.service.GDataService() # Tell the client that we are running in single user mode, and it should not # automatically try to associate the token with the current user then store # it in the datastore. gdata.alt.appengine.run_on_appengine(client, store_tokens=False, single_user_mode=True) client.email = 'myuserid' client.password = 'mypass' # To request a ClientLogin token you must specify the desired service using # its service name. # "wise" is the codename for GoogleDocs - see this page: # http://ruscoe.net/google/google-account-service-names/ client.service = 'wise' # Request a ClientLogin token, which will be placed in the client's current_token member. client.ProgrammaticLogin() gdata.alt.appengine.run_on_appengine(client) new_entry = gdata.GDataEntry() gdata.alt.appengine.run_on_appengine(new_entry) new_entry.title = gdata.atom.Title (text='MyBlankSpreadsheetTitle') category = gdata.atom.Category (scheme=gdata.docs.service.DATA_KIND_SCHEME, term=gdata.docs.service.SPREADSHEET_KIND_TERM) gdata.alt.appengine.run_on_appengine(category) new_entry.category.append(category) created_entry = client.Post(new_entry, 'http://docs.google.com/ feeds/documents/private/full') ----------------------------------------------------------------------------------------- ERROR: ----------------------------------------------------------------------------------------- Traceback (most recent call last): File "c:\program files\google\google_appengine\google\appengine\ext \webapp\__init__.py", line 498, in __call__ handler.get(*groups) File "d:\GoogleAppEngine\3WCloud.com.Provisioning\provisioning.py", line 1143, in get created_entry = client.Post(new_entry, 'http://docs.google.com/ feeds/documents/private/full') File "c:\program files\google\google_appengine\gdata\service.py", line 1178, in Post media_source=media_source, converter=converter) File "c:\program files\google\google_appengine\gdata\service.py", line 1298, in PostOrPut 'reason': server_response.reason, 'body': result_body} RequestError: {'status': 401, 'body': '<HTML>\n<HEAD>\n<TITLE>Token invalid</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000"> \n<H1>Token invalid</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n', 'reason': ''} Line 1143 is this line (the last line of the code above) created_entry = client.Post(new_entry, 'http://docs.google.com/feeds/ documents/private/full') When I go to that users docs, no spreadsheet was created. I'm also unclear when I have to use the gdata.alt.appengine.run_on_appengine(xxx) syntax. I get the same error when I remove all of them except the first one. Not sure if my feed is not well formed, or some other issue. I also tried a few other feed urls: # http://docs.google.com/a/mydomain.com/docs/feeds/documents/private/full # http://docs.google.com/a/mydomain.com/#spreadsheets Documentation implies that if I'm logged on, I don't need my domain in it. Thanks in advance, Neal Walters --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" 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-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
