如何 post 使用 facebook-sdk python 在我是其成员的 facebook 群组中
how to post in facebook group that's im member on it using facebook-sdk python
我在 posting 在 facebook 群组应用程序中工作,这是我的代码,但只有 post 在群组中,我是管理员,无论如何只有 post 在一个群组中那不是我使用 facebook-sdk python lib 的管理员吗?
我的代码
导入脸书
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
您无法再获取您所属群组的列表,您只能获取您管理的群组并且您需要使用 user_managed_groups
权限。 user_groups
权限已消失,没有替代品。
试试 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'
我在 posting 在 facebook 群组应用程序中工作,这是我的代码,但只有 post 在群组中,我是管理员,无论如何只有 post 在一个群组中那不是我使用 facebook-sdk python lib 的管理员吗? 我的代码 导入脸书
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
您无法再获取您所属群组的列表,您只能获取您管理的群组并且您需要使用 user_managed_groups
权限。 user_groups
权限已消失,没有替代品。
试试 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'