1

我的代码:

    def posting(self , facebook_id , message):
      access_token = "my access_token"
      post_data = {'access_token':access_token, 'message':message}
      request_path = str(facebook_id)+'/feed'
      post_data = urllib.urlencode(post_data)
      response = urllib2.urlopen('https://graph.facebook.com/%s' % request_path, post_data)
      print "posting is successfull !! :D"

和错误:

response = urllib2.urlopen('https://graph.facebook.com/%s' % request_path, post_data)
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 410, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 448, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: Bad Request

问题是什么 ?这段代码几个月前就可以工作了吗?

4

0 回答 0