Goodreads Developers discussion

70 views
bugs > some URLs return 403 access forbidden

Comments Showing 1-8 of 8 (8 new)    post a comment »
dateDown arrow    newest »

message 1: by Teresa (new)

Teresa Hello,

I have been using my developer key to access Goodreads data but I have been running into 403 (access forbidden) response codes for URLs associated with certain userids but not for others, and I am wondering why.

For instance, this URL (with id=3061312) returns code 403:

https://www.goodreads.com/review/list...

While the following (with id=614778) successfully returns XML as expected:

https://www.goodreads.com/review/list...

I have a list of about 20 other users for which access is forbidden. I would really like to retrieve data for these users (for a thesis project) and do not understand why I cannot.

Any help would be appreciated, thank you,


message 2: by Marisa (new)

Marisa (moretta) | 13 comments Perhaps they have a private profile?


message 3: by Nesreensada (new)

Nesreensada | 5 comments you will need to get access token to access the user book or such info
an example code to get access token
# example code to access the Goodreads API
def get_access_token(client_key,client_secret):
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 authentication using oauth2
consumer = oauth2.Consumer(key= CLIENT_ID, secret= CLIENT_SECRET)
client = oauth2.Client(consumer) #create the client
# The OAuth Client request to get access token
response, content = client.request(request_token_url, 'GET')
if response['status'] != '200':
raise Exception('Invalid response: %s' % response['status'])

#get access token
request_token = dict(urllib.parse.parse_qsl(content))
oauth_token_key,oauth_token_secret = request_token[b'oauth_token'], request_token[b'oauth_token_secret']
return oauth_token_key, oauth_token_secret

# functions requiring access token for publishing or reading user profiles


message 4: by Teresa (new)

Teresa The forbidden URLs are not for private profiles, because I can access these profiles by viewing them as a normal Goodreads user.


message 5: by Teresa (new)

Teresa Thanks for the info Nesreensada, but why would I need access tokens for some profiles and not for others, if all the profiles are public?


message 6: by Nesreensada (new)

Nesreensada | 5 comments I think for all users but I did not check
There is also a good library that you can use
https://github.com/sefakilic/goodreads
If you are using python


message 7: by Teresa (new)

Teresa Yes I am using that library from sefakilic on github


message 8: by Nesreensada (new)

Nesreensada | 5 comments So since it is working u will need to get access token


back to top