0
votes

I am trying to integrate facebook login to my GAE application using Facebook SDK for python (https://github.com/pythonforfacebook/facebook-sdk). Everything worked fine and I reached till the step where i get the access token. Here goes my code:

code = self.request.get('code')
access_token = parse_qs(urllib2.urlopen("https://graph.facebook.com/oauth/access_token?client_id=%s&redirect_uri=%s&client_secret=%s&code=%s"%(FACEBOOK_APP_ID, 'http://localhost:8080/_ah/login_required/fb', FACEBOOK_APP_SECRET, code)).read())['access_token'][0]
graph = facebook.GraphAPI(access_token)
user = graph.get_object("me")

In the last line I get the following error:

 File "#/handler.py", line 29, in get
    user = graph.get_object("me")
  File "#/facebook.py", line 96, in get_object
    return self.request(id, args)
  File "#/facebook.py", line 223, in request
    response = _parse_json(file.read())
NameError: global name '_parse_json' is not defined

The facebook.py file is from the official facebook sdk and I dont see _parse_json defined anywhere. Nor can I find any python module named so. What should I do?

1

1 Answers

0
votes

The current Facebook SDK has a dependency on the "requests" library see the setup.py for the SDK https://github.com/pythonforfacebook/facebook-sdk/blob/master/setup.py

Requests library - https://pypi.python.org/pypi/requests

Have you installed/copied that library into your project ?