Posting to Facebook wall

前端 未结 1 485
礼貌的吻别
礼貌的吻别 2021-01-06 04:43

This has been asked several times, but after reading many different posts I still have not a basic version running for posting to a wall.

I want to post to a wall of

相关标签:
1条回答
  • 2021-01-06 05:02

    An access token is used to authorize your application to do stuff on the users behalf. There are several ways (also referred to as "flows") to get such a token, you can read up on it here: Facebook Developers Access Tokens. Facebook provides a tool for generating test tokens, you can find it here: Facebook Developers Access Token Tool.

    Install facebook module by running the below command (if it isn't installed).

      pip install facebook-sdk
    

    Generate a token and run this code to post on your wall:

    import facebook
    
    ACCESS_TOKEN = "<your access token>"; # do not forget to add access token here
    graph = facebook.GraphAPI(ACCESS_TOKEN)
    graph.put_object("me", "feed", message="Hello, World!")
    
    0 讨论(0)
提交回复
热议问题