python - Getting Facebook access token for graph API application search -


i have been using below link quite while search facebook applications on graph api. see below link, searching applications word "bingo" in it.

https://graph.facebook.com/search?type=application&q=bingo

everything worked fine till 10th of july, when facebook made changes, see below text found on https://developers.facebook.com/docs/reference/api/search/#access_tokens:

the graph api search interface has changes pending q3 2013 migration. please see blog post more information on what's changed. changes listed in blog post go live on july 10th, 2013.

now, tried follow examples on https://developers.facebook.com/docs/reference/api/search/#access_tokens application access token , append access_token= link above (https://graph.facebook.com/search?type=application&q=bingo) still getting same response facebook graph:

{    "error": {       "message": "(#200) must have valid access_token access endpoint",       "type": "oauthexception",       "code": 200    } } 

does know how work around?

you have encode access token http header of request. facebook 1.1 api, usage of oauth2 lib python recommended.

import oauth2  import urllib  access_token_key = "your token key" access_token_secret = "your token secret"  consumer_key = "your consumer key" consumer_secret = "your consumer secret"   oauth_token    = oauth.token(key=access_token_key, secret=access_token_secret) oauth_consumer = oauth.consumer(key=consumer_key, secret=consumer_secret)   req = oauth2.request.from_consumer_and_token(oauth_consumer,                                              token=oauth_token,                                              http_method=http_method,                                              http_url=url,                                               parameters=parameters)  req.sign_request(signature_method_hmac_sha1, oauth_consumer, oauth_token)    headers = req.to_header()    if http_method == "post":     encoded_post_data = req.to_postdata()   else:     encoded_post_data = none     url = req.to_url()   urllib.urlopen(url, encoded_post_data) 

to oauth tokens , secrets, need define , register application twitter. (http://developers.twitter.com)

best regards, dave


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -