我在facebook群组中发布应用程序,这是我的代码,但是我在管理员群组中的帖子只有在帖子中才会发布在我不知道的群组中管理员使用facebook-sdk python lib? 我的代码 导入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
答案 0 :(得分:1)
您无法获得您已成为其成员的群组列表,您只能获得自己管理的群组,并且需要使用user_managed_groups
权限。 user_groups
权限已经消失,无法替换。
答案 1 :(得分:1)
尝试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'