Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiquery (suggestion) #40

Open
tarzasai opened this issue Mar 31, 2010 · 1 comment
Open

multiquery (suggestion) #40

tarzasai opened this issue Mar 31, 2010 · 1 comment

Comments

@tarzasai
Copy link

in facebook/init.py line 218 (fql methods) insert this:
'multiquery': [('queries', json, []),],

then try this:
fbc = Facebook("your_api_key", "")
# assign session_key and secret_key
data = fbc.fql.multiquery({"query1":"select post_id, actor_id, target_id, message from stream where filter_key in (select filter_key from stream_filter where uid={your_uid} AND type='newsfeed')", "query2":"select name from user where uid in (select actor_id from #query1)",})

http://wiki.developers.facebook.com/index.php/Fql.multiquery

@ljluestc
Copy link

import json
import requests

class Facebook:
    def __init__(self, api_key, session_key):
        self.api_key = api_key
        self.session_key = session_key
        self.secret_key = ""

    def fql_multiquery(self, queries):
        url = "https://api.facebook.com/method/fql.multiquery"
        params = {
            "queries": json.dumps(queries),
            "format": "json",
            "api_key": self.api_key,
            "session_key": self.session_key,
            "sig": self.generate_signature()
        }
        response = requests.get(url, params=params)
        data = response.json()
        return data

    def generate_signature(self):
        # Function to generate signature, implement as needed
        pass

# Usage example
fbc = Facebook("your_api_key", "your_session_key")
# Assign session_key and secret_key as needed
data = fbc.fql_multiquery({
    "query1": "select post_id, actor_id, target_id, message from stream where filter_key in (select filter_key from stream_filter where uid={your_uid} AND type='newsfeed')",
    "query2": "select name from user where uid in (select actor_id from #query1)"
})

print(data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants