无法获得Facebook-Tornado连接



我有一个问题,我是一个初学者,我尝试制作一个简单的异步程序发布到Facebook,我使用龙卷风示例和龙卷风-Facebook-SDK,这是代码:

class MainHandler(BaseHandler, tornado.auth.FacebookGraphMixin):
    @tornado.web.authenticated
    @tornado.web.asynchronous
    def get(self):
        self.facebook_request("/me/home", self.print_callback, access_token=self.current_user["access_token"])
        a = self.current_user["access_token"]
        #print a
    def print_callback(data):
        print data
        ioloop.stop()
        graph.get_object('/facebook', callback=print_callback)

我收到此错误:

TypeError: print_callback() takes exactly 1 argument (2 given)

因为我想了解此示例以获取令牌,然后使用示例:

def callback(response):
    # ...
graph.put_object('me', 'feed', message="Maoe!!", callback=callback)

为了在我的Facebook墙上写一些东西,我用同步库做了,但可悲的是,这是阻塞的!

更新:仍然得到和错误:

class MainHandler(BaseHandler, tornado.auth.FacebookGraphMixin):
    @tornado.web.authenticated
    @tornado.web.asynchronous
    def get(self):
        self.facebook_request("/me/home", self.print_callback, access_token=self.current_user["access_token"])
        a = self.current_user["access_token"]
        print a
    def print_callback(self, data):
        graph.post_wall(self, "heloooooooo")

并得到此错误:

[E 121009 14:28:47 web:1108] Uncaught exception GET / (::1)
HTTPRequest(.....)
Traceback (most recent call last):
File "C:Python27libsite-packagestornado-2.4.post1-py2.7.eggtornadoweb.py", line 1043, in _stack_context_handle_exception
   raise_exc_info((type, value, traceback))
   File "C:Python27libsite-packagestornado-2.4.post1 py2.7.eggtornadostack_context.py", line 237, in _nested
    yield vars
  File "C:Python27libsite-packagestornado-2.4.post1-py2.7.eggtornadostack_context.py", line 210, in wrapped
    callback(*args, **kwargs)
  File "C:Python27libsite-packagestornado-2.4.post1-py2.7.eggtornadogen.py", line 405, in inner self.set_result(key, result)
  File "C:Python27libsite-packagestornado-2.4.post1-py2.7.eggtornadogen.py", line 335, in set_result
    self.run()
  File "C:Python27libsite-packagestornado-2.4.post1-py2.7.eggtornadogen.py", line 365, in run
    yielded = self.gen.send(next)
  File "buildbdist.win-amd64eggfacebookgraphapi.py", line 129, in _make_request
    raise GraphAPIError(data)
GraphAPIError: (#200) This API call requires a valid app_id.

当我去Facebook时,我看到它是我正在使用的有效密钥,我什至使用生成的令牌(这里是a变量),并将其粘贴到Api调试中,我得到一切正常:

 Valid : True
 Origin : Web
 Scopes : create_note photo_upload publish_actions publish_stream read_stream share_item status_update video_upload

self添加到print_callback

def print_callback(self, data):
    print data
    ioloop.stop()
    graph.get_object('/facebook', callback=print_callback)

最新更新