Tor*_*xed 40 python api facebook signature pyfacebook
好吧,所以我google了一下,我在stackoverflow上找到了线程,我已经检查了官方的Facebook wiki和..什么不是..
我现在希望你们其中一个人坐在用于Python的Facebook API示例代码上.这就是我到目前为止所得到的只是通过PyFacebook的"无效签名",这似乎是一个死的项目:
from facebook import Facebook
api_key = '123456789______'
secret = '<proper secret key>'
OTK = 'XXXXX' # <-- You get this from: https://www.facebook.com/code_gen.php?v=1.0&api_key=123456789______
long_term_key = None
fb = Facebook(api_key, secret)
def generate_session_from_onetime_code(fb, code):
fb.auth_token = code
return fb.auth.getSession()
if not long_term_key:
long_term_key = generate_session_from_onetime_code(fb, OTK)['session_key']
print 'Replace None with this in the .py file for long_term_key:'
print long_term_key
fb.session_key = long_term_key
fb.uid = 000000001 # <-- Your user-id
fb.signature = api_key # <-- This doesn't work at all, MD5 of what?
#fb.validate_signature(fb) # <-- doesn't work either, prob need to pass MD5 handle?
print fb.friends.get() # <-- Generates "Invalid Signature"
Run Code Online (Sandbox Code Playgroud)
"所有"我想要的,就是现在检索我的朋友列表,如果有更好的API指向我正确的方向但Facebook已经正式宣布他们自己的Python SDK死了,pyfacebook几乎为我工作但不完全..
所以,请帮忙.
dom*_*dom 69
python sdk的非官方分支对我来说仍然很好.
要检索您的朋友,请在此处生成访问令牌:https: //developers.facebook.com/tools/access_token/
限制:
码
Run Code Online (Sandbox Code Playgroud)import facebook token = 'your token' graph = facebook.GraphAPI(token) profile = graph.get_object("me") friends = graph.get_connections("me", "friends") friend_list = [friend['name'] for friend in friends['data']] print friend_list
归档时间: |
|
查看次数: |
73416 次 |
最近记录: |