doganaydin/themoviedb — Issue #4: auth.session_id() generates Error
Author: tapasbose
Created: 2012-02-28 17:01:27+00:00
State: open

Hello,

I am using your API. So far I have tested few methods. Everything works fine, except the session_id() method.

Your Read Me you gave an example of User Authentication:

import tmdb
tmdb.configure(yourapikey)
auth = tmdb.Core()
rt = tmdb.request_token()
#{"url":"http://themoviedb.org/authenticate/request_token","request_token":"requested_token"}
auth.session_id(rt["request_token"])
#return session_id

This should be

import tmdb
tmdb.configure(yourapikey)
auth = tmdb.Core()
rt = auth.request_token()
auth.session_id(rt["request_token"])

I have tested it after modification. But I got this error:

Traceback (most recent call last):
File "", line 1, in
auth.session_id(rt["request_token"])
File "C:\Python27\lib\site-packages\tmdb.py", line 92, in session_id
return sess["session_id"]
KeyError: 'session_id'

I changed the session_id(self,token) method as:

def session_id(self,token):
sess = self.getJSON(config['urls']['session.id'] % token)
# config['api']['session.id'] = sess["session_id"]
return sess

And it prints in shell:

{u'status_code': 17, u'status_message': u'Session denied'}

I will wait for your reply.

Regards.