简体   繁体   English

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

[英]how to post in facebook group that's im member on it using facebook-sdk python

i working in posting in facebook groups app that's are my code but that's only post in the groups im admin on it only are there anyway to post in a group that's im not admin on it using facebook-sdk python lib ? 我在facebook群组应用程序中发布帖子,这是我的代码,但仅在im admin群组中发布,无论如何,使用facebook-sdk python lib在不是im admin的群组中发布吗? my code import facebook 我的代码导入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

You can´t get a list of groups you are member of anymore, you can only get groups you manage and you need to use the user_managed_groups permission. 您将无法再获得自己所属的组的列表,只能获得自己管理的组,并且需要使用user_managed_groups权限。 the user_groups permission is gone and there is no replacement. user_groups权限已消失,无法替代。

Try dis Man :D 试试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'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM