I was able to use GData with AuthSub well enough in the C# libraries,
when i went to the AppEngine to do the same thing in Python i thought
it would be easier but it's turning out to be a pain and i'm running
out of ideas.

I'm able to get a temporary token (i print it and it looks fine,
similar to i was getting in c#) but i get an error when i try to
upgrade to a session token, this is the stack trace:

Traceback (most recent call last):
  File "/base/python_lib/versions/1/google/appengine/ext/webapp/
__init__.py", line 499, in __call__
    handler.get(*groups)
  File "/base/data/home/apps/latexlab/1.65/main.py", line 45, in get
    self.client.UpgradeToSessionToken()
  File "/base/data/home/apps/latexlab/1.65/gdata/service.py", line
568, in UpgradeToSessionToken
    self.SetAuthSubToken(self.upgrade_to_session_token(token))
  File "/base/data/home/apps/latexlab/1.65/gdata/service.py", line
595, in upgrade_to_session_token
    'body': response_body})
TokenUpgradeFailed: {'status': 403L, 'body': '<HTML>\n<HEAD>
\n<TITLE>Invalid AuthSub token.</TITLE>\n</HEAD>\n<BODY
BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Invalid AuthSub token.</H1>
\n<H2>Error 403</H2>\n</BODY>\n</HTML>\n', 'reason': 'Non 200 response
on upgrade'}

I was actually getting a NonAuthSubToken exception earlier instead but
it changed to a TokenUpgradeFailed exception (also in
UpgradeToSessionToken).

The code i'm using is at the end of this message, i've tried code from
two samples with same results:
http://code.google.com/appengine/articles/gdata.html#configure
http://code.google.com/apis/documents/developers_guide_python.html

If you understand what's going on please let me know and thanks for
the help.

import os
import urllib
import wsgiref.handlers
from google.appengine.api import users
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app
import gdata.service
import gdata.alt.appengine

class MainPage(webapp.RequestHandler):
  def __init__(self):
    self.current_user = None
    self.token_scope = None
    self.client = None
    self.token = None
  def get(self):
    if self.request.get('token'):
      self.token = self.request.get('token')
      self.client = gdata.service.GDataService()
      gdata.alt.appengine.run_on_appengine(self.client)
      self.client.SetAuthSubToken(self.token)
      self.client.UpgradeToSessionToken()
    else:
      self.client = gdata.service.GDataService()
      redirect_url = self.client.GenerateAuthSubURL('http://
gdocs.latexlab.org/',
                                             'http://docs.google.com/
feeds/',
                                             secure=True,
                                             session=True)
      self.redirect(redirect_url.to_string())


application = webapp.WSGIApplication([('/', MainPage)], debug=True)

def main():
  run_wsgi_app(application)
if __name__ == "__main__":
  main()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Data Protocol" group.
To post to this group, send email to google-help-dataapi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to