如何使用facebook-sdk python在facebook组中发布我的成员

jdolor 发布于 2019-08-14 api 最后更新 2019-08-14 08:39 1 浏览

我在发布Facebook群组应用程序,这是我的代码,但这只是在组后即时通讯只在那里张贴在一个组,即时通讯不是管理员使用Facebook的sdk python库吗? 我的代码 导入Facebook

token = "my_acces_token"
graph = facebook.GraphAPI(token)
groups = graph.get_object("me/groups")
group_id = groups['data'][2]['id'] # we take the ID of the first group
for post in groups['data']:
        try:
                 graph.put_object(group_id, "feed", message="from terminal")
                 print "liking topic "+ groups['message']
except:
                continue
已邀请:

sest

赞同来自:

试试dis Man:D

access_token='Access_token'
import facebook 
graph=facebook.GraphAPI(access_token)
groups = graph.get_connections(id='me', connection_name='groups')
data = groups['data']
for s in data:
    l = s.values()    
    object_id= l[6]
    try:
        graph.put_object(object_id, 'feed',message="hola")
        print('Done, Posted in %s'%l[1].encode('utf-8',errors='ignore'))
    except Exception as e:
        print(e)
print 'Done, Posted in all groups'

but

赞同来自:

您无法获得您已成为其成员的组列表,您只能获得您管理的组,并且您需要使用user_managed_groups权限。 user_groups权限已消失,无法替换。