Django回调在Facebook Credits [英] Django Callback on Facebook Credits

查看:290
本文介绍了Django回调在Facebook Credits的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用我的Django应用程序使用Facebook Credits。



在Facebook Credits文档中,只有一个PHP回调页面示例//developers.facebook.com/blog/post/489 /)./p>

但是,我想在我的Django应用程序中开发一个回调。我已经为回调创建了一个视图,但现在我不知道Facebook发送给我什么和我应该如何解析。



我想这是一种POST HTTP请求具有一些参数我应该解析,但是如何?



感谢所有输入。

解决方案

他们向您发送需要解析的已签名请求。我建议阅读其余的facebook文档,如果你困惑的意思。



这家伙已经为你完成了php到python转换:
http://sunilarora.org/parsing-signedrequest-parameter-in- python-bas



一旦你解析了他们发送给你的东西,就完全按照他们在php脚本中做的。然后,你发送json回他们。在您的视图结束时:

  def fb_credits_callback(request):
#parse with parse function
#handle
return HttpResponse(json.dumps(data))


I would like to use Facebook Credits with my Django Application.

In the Facebook Credits documentation, there is only a sample for the callback page in PHP (https://developers.facebook.com/blog/post/489/).

However, I would like to develop a callback in my Django application. I already created a view for the callback, but now I have no idea what Facebook sends me and how should I parse it.

I suppose it is some kind of POST HTTP request with some parameters I should parse, but how?

Thank you for all input.

解决方案

They send you a signed request which you need to parse. I'd suggest reading the rest of the facebook documentation if you're confused about what that means.

This guy has already done the php to python conversion for you: http://sunilarora.org/parsing-signedrequest-parameter-in-python-bas

Once you've parsed what they sent you, do exactly what they do in the php script. Then, you send json back to them. At the end of your view:

def fb_credits_callback(request):
    # parse with your parse function
    # handle request
    return HttpResponse(json.dumps(data))

这篇关于Django回调在Facebook Credits的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆