google-code-export / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
1 stars 0 forks source link

Stacktrace from xmltools.parseAndStripWhitespace(key.pem) #487

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Code: See attachment
2. Add keys using cygwin/openssl. Upload cert to google, save key in 
/remotekey.pem
3. Start application

What is the expected output? What do you see instead?
I expected to see a link letting the user authorize a request token.
Instead I got an stack trace:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 515, in __call__
    handler.get(*groups)
  File "C:\Users\Joshua\appengineapps\jmm-timeline\main.py", line 64, in get
    req_token = client.FetchOAuthRequestToken(SCOPES)
  File "C:\Users\Joshua\appengineapps\jmm-timeline\gdata\service.py", line 415, in FetchOAuthRequestToken
    extra_parameters=extra_parameters)
  File "C:\Users\Joshua\appengineapps\jmm-timeline\gdata\auth.py", line 217, in GenerateOAuthRequestTokenUrl
    oauth_input_params.GetConsumer(), None)
  File "C:\Users\Joshua\appengineapps\jmm-timeline\gdata\oauth\__init__.py", line 171, in sign_request
    self.set_parameter('oauth_signature', self.build_signature(signature_method, consumer, token))
  File "C:\Users\Joshua\appengineapps\jmm-timeline\gdata\oauth\__init__.py", line 175, in build_signature
    return signature_method.build_signature(self, consumer, token)
  File "C:\Users\Joshua\appengineapps\jmm-timeline\gdata\oauth\rsa.py", line 55, in build_signature
    privatekey = keyfactory.parsePrivateKey(cert)
  File "C:\Users\Joshua\appengineapps\jmm-timeline\gdata\tlslite\utils\keyfactory.py", line 203, in parsePrivateKey
    return parseXMLKey(s, private=True)
  File "C:\Users\Joshua\appengineapps\jmm-timeline\gdata\tlslite\utils\keyfactory.py", line 79, in parseXMLKey
    key = Python_RSAKey.parseXML(s)
  File "C:\Users\Joshua\appengineapps\jmm-timeline\gdata\tlslite\utils\Python_RSAKey.py", line 137, in parseXML
    element = xmltools.parseAndStripWhitespace(s)
  File "C:\Users\Joshua\appengineapps\jmm-timeline\gdata\tlslite\utils\xmltools.py", line 30, in parseAndStripWhitespace
    raise SyntaxError(str(e))
SyntaxError: Parse() argument 1 must be string or read-only buffer, not None

That's 

Original issue reported on code.google.com by joshua.m...@gmail.com on 17 Jan 2011 at 9:37

Attachments:

GoogleCodeExporter commented 9 years ago
Issue 488 has been merged into this issue.

Original comment by vicfry...@google.com on 18 Jan 2011 at 11:52

GoogleCodeExporter commented 9 years ago

Original comment by vicfry...@google.com on 18 Jan 2011 at 11:53

GoogleCodeExporter commented 9 years ago
There are several issues with this code, the first is that you can't open a 
file like that on App Engine. 

f = open('remotekey.pem')
RSA_KEY = f.read()
f.close()

You must do something like:

f = open(os.path.join(os.path.dirname(__file__), 'remotekey.pem'))
RSA_KEY = f.read()
f.close()

Original comment by joe.gregorio@gmail.com on 20 Jan 2011 at 9:08