Ton*_*ino 2 python facebook-graph-api app-secret
使用python中的appsecret_proof参数进行图形api调用的正确方法是什么?有没有允许这样的东西的图书馆?
我试图使用'python for facebook'库,但文档实际上是不存在的,所以我无法弄明白.
gus*_*s27 10
以下是使用facebook-sdk的方法:
import facebook
import hashlib
import hmac
def genAppSecretProof(app_secret, access_token):
h = hmac.new (
app_secret.encode('utf-8'),
msg=access_token.encode('utf-8'),
digestmod=hashlib.sha256
)
return h.hexdigest()
app_secret = "xxxxxxxxx"
access_token = "xxxxxxxxx"
api = facebook.GraphAPI(access_token)
msg = "Hello, world!"
postargs = {"appsecret_proof": genAppSecretProof(app_secret, access_token)}
status = api.put_wall_post(msg, postargs)
Run Code Online (Sandbox Code Playgroud)
使用Python 2.7.9和facebook-sdk 1.0.0-alpha进行测试.
| 归档时间: |
|
| 查看次数: |
2576 次 |
| 最近记录: |