내 Facebook 앱에서 토네이도 프레임 워크를 사용하는 사용자에게 앱 요청을 보내려했습니다. http://www.tornadoweb.org/documentation/auth.html을 따라했지만이 오류를 해결하는 방법을 모릅니다. 밖에있는 전문가가 있습니까? 감사! 당신이 tornado.web.RequestHandler
를 서브 클래스 깜빡 같은토네이도 프레임 워크 (FacebookGraphMixin)
오류 로그
Traceback (most recent call last):
File "send.py", line 36, in <module>
main()
File "send.py", line 33, in main
test.get(app_access_token, player_id)
File "send.py", line 15, in get
callback=self.async_callback(self._on_post))
AttributeError: 'Send' object has no attribute 'async_callback'
코드
import tornado.auth
import tornado.escape
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado import httpclient
class Send(tornado.auth.FacebookGraphMixin):
def get(self, app_access_token, player_id):
self.facebook_request(
"/"+player_id+"/apprequests",
post_args={"message": "I am an app request from my Tornado application!"},
access_token=app_access_token,
callback=self.async_callback(self._on_post))
def _on_post(self, new_entry):
if not new_entry:
# Call failed; perhaps missing permission?
self.authorize_redirect()
return
self.finish("Posted a message!")
def main():
key = "xxxxxxxxxxx"
secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
player_id = "100003395454290" #fake id
http_client = httpclient.HTTPClient()
response = http_client.fetch("https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id="+key+"&client_secret="+secret+"&redirect_uri=&code=")
app_access_token = response.body.replace("access_token=","")
test = Send()
test.get(app_access_token, player_id)
if __name__ == "__main__":
main()
안녕하세요, 감사합니다. Rob! 하지만 토네이도없이 이것을 할 수있는 방법이 있습니다. 웹. 요청자입니다. – yori
@yori,'async_callback'은'tornado.web.RequestHandler'의 메소드입니다. 그래서 당신은 그 메소드를 사용하지 않고 그것을 수행 할 방법을 찾아야 할 것입니다. –
궁금한 점이 ... 토네이도를 사용하지 않고도 가능하다고 생각하십니까? 웹입니다. 요청 해 드리겠습니다. 내 상사가 tornado.web를 사용하지 말라고 요청했습니다 .RequestHandler :(이유가 약간 분실되었습니다.) – yori