Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
222 views
Welcome To Ask or Share your Answers For Others

1 Answer

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))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...