views:

142

answers:

0

Hi, I am using Django PyFacebook Middleware to allow users to connect.

def index(request):
    FBGRABLIST = ['name', 'pic','uid','first_name','last_name', 'email']
    fbdata = []
    if request.facebook.check_session(request):
            fbdata = request.facebook.users.getInfo(request.facebook.uid, FBGRABLIST)[0]
            print fbdata
    return render_to_response('home.html')

As you can see, this works. This will print out a dictionary of first_name, pic, email, etc.

However...if I add 'hometown', 'activities', 'interests' to the list...it won't work! Instead, it will shoot me a big traceback error. I'm assuming that the user hasn't filled out "hometown" and "activities".

How do I get their info, and if they haven't filled it out...just...blank or something?

Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
  92.                 response = callback(request, *callback_args, **callback_kwargs)
File "/home/ea/ea-repos/hag/life/views.py" in index
  33.             fbdata = request.facebook.users.getInfo(request.facebook.uid, FBGRABLIST)[0]
File "/home/ea/ea-repos/hag/facebook/__init__.py" in __call__
  517.         return self._client('%s.%s' % (self._name, method), args)
File "/home/ea/ea-repos/hag/facebook/__init__.py" in __call__
  1002.         return self._parse_response(response, method)
File "/home/ea/ea-repos/hag/facebook/__init__.py" in _parse_response
  939.             self._check_error(result)
File "/home/ea/ea-repos/hag/facebook/__init__.py" in _check_error
  890.             raise FacebookError(response['error_code'], response['error_msg'], response['request_args'])

Exception Type: FacebookError at /
Exception Value: ({u'value': u'1bdcdc1f615904b9f63b7dcf7a4e42', u'key': u'api_key'}, {u'value': u'1000045453434', u'key': u'uids'}, {u'value': u'JSON', u'key': u'format'}, {u'value': u'name,pic,uid,first_name,last_name,email,hometown', u'key': u'fields'}, {u'value': u'1262700145', u'key': u'call_id'}, {u'value': u'c019dde2aa9037b548243e585f2632', u'key': u'sig'}, {u'value': u'1.0', u'key': u'v'}, {u'value': u'3.eFvlR0BIyU5ilpSBx5GUA__.3600.1265248800-10000054534134', u'key': u'session_key'}, {u'value': u'facebook.users.getInfo', u'key': u'method'})