python - Facebook publish HTTP Error 400 : bad request -
hey trying publish score facebook through python's urllib2 library.
import urllib2,urllib url = "https://graph.facebook.com/user_id/scores" data = {} data['score']=score data['access_token']='app_access_token' data_encode = urllib.urlencode(data) request = urllib2.request(url, data_encode) response = urllib2.urlopen(request) responseasstring = response.read()
i getting error:
response = urllib2.urlopen(request) file "/system/library/frameworks/python.framework/versions/2.6/lib/python2.6/urllib2.py", line 124, in urlopen return _opener.open(url, data, timeout) file "/system/library/frameworks/python.framework/versions/2.6/lib/python2.6/urllib2.py", line 389, in open response = meth(req, response) file "/system/library/frameworks/python.framework/versions/2.6/lib/python2.6/urllib2.py", line 502, in http_response 'http', request, response, code, msg, hdrs) file "/system/library/frameworks/python.framework/versions/2.6/lib/python2.6/urllib2.py", line 427, in error return self._call_chain(*args) file "/system/library/frameworks/python.framework/versions/2.6/lib/python2.6/urllib2.py", line 361, in _call_chain result = func(*args) file "/system/library/frameworks/python.framework/versions/2.6/lib/python2.6/urllib2.py", line 510, in http_error_default raise httperror(req.get_full_url(), code, msg, hdrs, fp) urllib2.httperror: http error 400: bad request
not sure if relating facebook's open graph or improper urllib2 api use.
i ran code , got same error (there no more error in body, have posted in comment can't yet guess) googled "publish facebook scores."
i believe you'll need grant app permission publish scores first, unless you've done already. see http://developers.facebook.com/blog/post/539/.
Comments
Post a Comment