Goodreads Developers discussion

37 views
questions > Python - getting 401 error code on a simple token request

Comments Showing 1-2 of 2 (2 new)    post a comment »
dateUp arrow    newest »

message 1: by Suberri (new)

Suberri | 2 comments I just join goodreads developer community and received a key and a secret key.
I tried a simple Python script and I am always get 401 as a response.

The python script:
--------------------------

import oauth2 as oauth
import urlparse

gr_key= the key I received from goodreads today
gr_secret= he key I received from goodreads today

url = 'http://www.goodreads.com'
request_token_url = '%s/oauth/request_token/' % url
authorize_url = '%s/oauth/authorize/' % url
access_token_url = '%s/oauth/access_token/' % url

consumer = oauth.Consumer(key=gr_key,secret=gr_secret)

client = oauth.Client(consumer)

response, content = client.request(request_token_url, 'GET')
if response['status'] != '200':
raise Exception('Invalid response: %s' % response['status'])

-----------------------------
any idea why am I getting 401.
Are the keys that goodreads send me can be used immediately?
Do I need to add the application name somewhere?


message 2: by Suberri (new)

Suberri | 2 comments The curl command with my key does work


back to top