Home
My Books
Browse ▾
Recommendations
Choice Awards
Genres
Giveaways
New Releases
Lists
Explore
News & Interviews
Genres
Art
Biography
Business
Children's
Christian
Classics
Comics
Cookbooks
Ebooks
Fantasy
Fiction
Graphic Novels
Historical Fiction
History
Horror
Memoir
Music
Mystery
Nonfiction
Poetry
Psychology
Romance
Science
Science Fiction
Self Help
Sports
Thriller
Travel
Young Adult
More Genres
Community ▾
Groups
Quotes
Ask the Author
Sign In
Join
Sign up
View profile
Profile
Friends
Groups
Discussions
Comments
Reading Challenge
Kindle Notes & Highlights
Quotes
Favorite genres
Friends’ recommendations
Account settings
Help
Sign out
Home
My Books
Browse ▾
Recommendations
Choice Awards
Genres
Giveaways
New Releases
Lists
Explore
News & Interviews
Genres
Art
Biography
Business
Children's
Christian
Classics
Comics
Cookbooks
Ebooks
Fantasy
Fiction
Graphic Novels
Historical Fiction
History
Horror
Memoir
Music
Mystery
Nonfiction
Poetry
Psychology
Romance
Science
Science Fiction
Self Help
Sports
Thriller
Travel
Young Adult
More Genres
Community ▾
Groups
Quotes
Ask the Author
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 »
date
newest »
message 1:
by
Suberri
(new)
Jun 29, 2016 06:42PM
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?
reply
|
flag
message 2:
by
Suberri
(new)
Jun 29, 2016 06:55PM
The curl command with my key does work
reply
|
flag
back to top
post a comment »
Add a reference:
Book
Author
Search for a book to add a reference
add:
link
cover
Author:
add:
link
photo
Share
Goodreads Developers
Group Home
Bookshelf
Discussions
Photos
Videos
Send invite
Members
Polls
unread topics
|
mark unread
Welcome back. Just a moment while we sign you in to your Goodreads account.
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?