How to connect to Facebook Graph API from Python using Requests if I do not need user access token?

前端 未结 2 842
你的背包
你的背包 2020-12-28 10:08

I am trying to find the easiest way how to use Facebook Graph API using my favorite Requests library. The problem is, all examples I found are about getting user acc

2条回答
  •  伪装坚强ぢ
    2020-12-28 10:45

    Following https://developers.facebook.com/docs/technical-guides/opengraph/publishing-with-app-token/:

    import requests
    r = requests.get('https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=123&client_secret=XXX')
    access_token = r.text.split('=')[1]
    print access_token
    

    (using the correct values for client_id and client_secret) gives me something that looks like an access token.

提交回复
热议问题