python - facebook.GraphAPIError: An active access token must be used to query information about the current user -
I am getting this error in my friends list trying to print a little longer. I am a lot, I am providing a token. Any ideas on this?
Import Import Import urllib import urllib2 import json import urlparse import subprocess import alert import urllib2 import json #https: //developers.facebook.com/tools/access_token/ # your app the parameter profile id like to mess with you FACEBOOK_APP_ID = '{app_id}' FACEBOOK_APP_SECRET = '{app_secret}' FACEBOOK_PROFILE_ID = 'my-id-number-here' # access is trying to get the token. Very strange Oauth_args = dict (client_id = FACEBOOK_APP_ID, client_secret = FACEBOOK_APP_SECRET, Anudan_prkar = 'Claintkadenshiyl') oauth_curl_cmd = [ 'curl', 'https://graph.facebook.com/oauth/access_token?' + Urlib.urlencode (oauth_args)] oauth_response = subprocess.Popen (oauth_curl_cmd, stdout = subprocess.PIPE, stderr = subprocess.PIPE) .communicate () [0] Try: oauth_access_token = urlparse.parse_qs (str (oauth_response)) [ 'Access_token'] [0] except keyError: Print (unable to achieve 'access tokens') exit () facebook_graph = facebook.GraphAPI (oauth_access_token) # list of friends Print profile = facebook_graph.get_object ( "I" ) More = facebook_graph.get_connections ( "I", "friends") friend_list = [More [ 'name'] [ 'data to friends of friends']] print friend_list
You get this error So getting because you are not using the access token to a user token.
Just click Get token> Get User Access Token This is the trick for me
/ Html>
Comments
Post a Comment