您好我在php中使用此代码检查是否使用signed_request喜欢粉丝页面:
private function parsePageSignedRequest()
{
if (isset($_REQUEST['signed_request']))
{
$encoded_sig = null;
$payload = null;
list($encoded_sig, $payload) = explode('.', $_REQUEST['signed_request'], 2);
$sig = base64_decode(strtr($encoded_sig, '-_', '+/'));
$data = json_decode(base64_decode(strtr($payload, '-_', '+/'), true));
return $data;
}
return false;
}
function isLiked()
{
$signed_request = $this->parsePageSignedRequest();
if($signed_request->page->liked)
{
return true;
} else {
return false;
}
}
我怎么能为python / django写这个?