python oauth problem

63 views
Skip to first unread message

de di

unread,
Apr 18, 2011, 10:40:03 AM4/18/11
to TypePad Developers Network
hi,

I'm trying to get an app authorized to access my blog; I follow the
steps detailed at http://sixapart.github.com/python-typepad-api/tut/auth.html,
but I get a python error.

Any help will be greatly appreciated:

Here's my python output:

$ python
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import typepad
>>> from oauth import oauth
>>> app=typepad.Application.get_by_id(<my app_id>)
>>> consumer=oauth.OAuthConsumer(<my app consumer key>,<my app consumer secret>)
>>> app.name
<output my app name correctly>
>>> token=typepad.client.interactive_authorize(consumer,app)
To join your application <my app name>, follow this link and click
"Allow":

<https://www.typepad.com/secure/services/api/.....>

Enter the verifier code TypePad gave you: <here I enter the number on
the browser>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "typepad/tpclient.py", line 214, in interactive_authorize
access_token = oauth_client.fetch_access_token(verifier=verifier)
File "typepad/tpclient.py", line 305, in fetch_access_token
self.token = oauth.OAuthToken.from_string(content)
File "/usr/lib/python2.6/dist-packages/oauth/oauth.py", line 142, in
from_string
key = params['oauth_token'][0]
KeyError: 'oauth_token'


de di

unread,
Apr 18, 2011, 11:00:47 AM4/18/11
to TypePad Developers Network
Hi,


Tried some code from the discussion groups, and I get the following
debug message:


oauth_token=ec260bf65c55d87d1aac7eecef547676841d0c06cb4f457449c6f0c7a86c893e4de43a075155b19e4b9156ac64a4907cf79a533aaf9bea6c4d1ed580290d6f78&oauth_token_secret=dEfo8EGnSpEjnpZq&oauth_callback_confirmed=true
>>> print oauth_client.authorize_token()
https://www.typepad.com/secure/services/api/6p01538ddd911b970b/oauth-approve?oauth_token=ec260bf65c55d87d1aac7eecef547676841d0c06cb4f457449c6f0c7a86c893e4de43a075155b19e4b9156ac64a4907cf79a533aaf9bea6c4d1ed580290d6f78
>>> access_token = oauth_client.fetch_access_token(verifier='90124107')
DEBUG:batchhttp.client.response:Got response:
status: 400
content-length: 36
cache-control: private
vary: cookie
keep-alive: timeout=30, max=100
server: Apache
connection: keep-alive
pragma: no-cache
x-webserver: oak-tp-app006
date: Mon, 18 Apr 2011 14:57:38 GMT
content-type: text/html; charset=utf-8

The parameter 'verifier' is required
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "typepad/tpclient.py", line 305, in fetch_access_token
self.token = oauth.OAuthToken.from_string(content)
File "/usr/lib/python2.6/dist-packages/oauth/oauth.py", line 142, in
from_string
key = params['oauth_token'][0]
KeyError: 'oauth_token'



Any hints?

Thanks



On Apr 18, 4:40 pm, de di <carles....@gmail.com> wrote:
> hi,
>
> I'm trying to get an app authorized to access my blog; I follow the
> steps detailed athttp://sixapart.github.com/python-typepad-api/tut/auth.html,
Reply all
Reply to author
Forward
0 new messages