error message “(#12) fql is deprecated for versions v2.1 and higher”


error message “(#12) fql is deprecated for versions v2.1 and higher”



I tried to fetching facebook messages using python script which is mentioned in the code below :


#!/usr/bin/python


import sys

from facepy import GraphAPI
from facepy import exceptions

#Acces token with expire time = 60days
LONG_LIVE_ACCESS_TOKEN = 'EAAZA7IlqBfvkBAKOjc7esSqY1VRJdsMkZC6QXM2mVlAwZAWjOiZA2ywalERBjLk4tzvZBu8JvoWvLRGcTtyZAGl482ueUI1o6MWjkK44y3TeoVKjYBayO5DSIP3Q1poVEa8hO8xZAXdScohEAgiFTtpvVQGk2nZB694ZD'

#Facebook app id and secret from http://developer.facebook.com/apps
APP_ID = '1824237337804537'
SECRET_KEY = 'ee788eb9bea6d36f5f40e52530248f55'

def user_id_to_username(userid):

""" Function to convert facebook USERID to username. """

if userid is not None:

userid = '/{0}'.format(userid)
try:
return graph.get(userid)['name']

except (exceptions.FacebookError, exceptions.OAuthError) as e:
print e.message
sys.exit(0)

def get_message_author(message_list):
return user_id_to_username(message_list['snippet_author'])


def get_message_author_id(message_list):
return message_list['snippet_author']


def get_message_body(message_list):
return message_list['snippet']


def get_recipients_list(message_list):
author = get_message_author_id(message_list)
temp = message_list['recipients']
temp.remove(author)
return ", ".join(map(user_id_to_username, temp))


def pretty_print(message_list):
for message in message_list:
print "from: ", get_message_author(message)
print "to: ", get_recipients_list(message)
print "Message: ", get_message_body(message)
print "-" * 140

graph = GraphAPI(LONG_LIVE_ACCESS_TOKEN)

#Output of the facebook query language(FQL)
#This FQL queries for message body, author, recipients for unread messages.

try:
json_output = graph.fql('SELECT snippet, snippet_author, recipients FROM thread WHERE folder_id = 0 and unread != 0 Limit 4')
except exceptions.OAuthError as e:
print e.message
sys.exit(0)


message_list = json_output['data']

if message_list:
pretty_print(message_list)
else:
print "No New Messages"
sys.exit(0)



on executing this script it shows the error message :



(#12) fql is deprecated for versions v2.1 and higher





what is not clear about that very specific error messasge?
– luschn
Aug 5 '16 at 7:40




1 Answer
1



FQL is deprecated and will be completely unsupported by Facebook by August 8, 2016. Facebook Query Language (FQL) Reference:



As of August 8, 2016, FQL will no longer be available and cannot be
queried. To migrate your app, use the API Upgrade Tool to see the
Graph API calls you can make instead.


FQL






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Render GeoTiff to on browser with leaflet

How to get chrome logged in user's email id through website

using states in a react-navigation without redux