我没有使用 Facebook SDK 删除对象的权限
I don't have permission to delete objects with the Facebook SDK
我正在尝试执行一个 Python 脚本来检索我的 post 并且能够删除其中的一些。检索一切似乎都很好,但是当我调用 delete_object
方法时,它说我没有权限。
我有我的用户访问令牌,我在仪表板上授予了所有权限。然后从我的 Facebook 个人资料中,我同意我的应用程序执行所有操作。
这是一个简单的函数,它将 post 个 ID 列表作为输入:
fb = facebook.GraphAPI(token, version="3.1")
my_profile = fb.get_object('me')
my_id = my_profile["id"]
def delete_posts(posts):
for i in range(len(posts)):
fb.delete_object(posts[i])
这是错误:
Traceback (most recent call last):
File "D:/Download/FBHandler/main.py", line 159, in <module>
fb.delete_object(id)
File "D:\Download\FBHandler\venv\lib\site-packages\facebook\__init__.py", line 197, in delete_object
return self.request("{0}/{1}".format(self.version, id), method="DELETE")
File "D:\Download\FBHandler\venv\lib\site-packages\facebook\__init__.py", line 299, in request
raise GraphAPIError(result)
facebook.GraphAPIError: (#200) The user hasn't authorized the application to perform this action
https://developers.facebook.com/docs/graph-api/reference/v3.3/post#deleting
An app can delete any post it published, or a page-management app can delete a Post published to a Page that the app manages.
如果 post 不是由该 App 创建的,则无法删除它。
我正在尝试执行一个 Python 脚本来检索我的 post 并且能够删除其中的一些。检索一切似乎都很好,但是当我调用 delete_object
方法时,它说我没有权限。
我有我的用户访问令牌,我在仪表板上授予了所有权限。然后从我的 Facebook 个人资料中,我同意我的应用程序执行所有操作。
这是一个简单的函数,它将 post 个 ID 列表作为输入:
fb = facebook.GraphAPI(token, version="3.1")
my_profile = fb.get_object('me')
my_id = my_profile["id"]
def delete_posts(posts):
for i in range(len(posts)):
fb.delete_object(posts[i])
这是错误:
Traceback (most recent call last):
File "D:/Download/FBHandler/main.py", line 159, in <module>
fb.delete_object(id)
File "D:\Download\FBHandler\venv\lib\site-packages\facebook\__init__.py", line 197, in delete_object
return self.request("{0}/{1}".format(self.version, id), method="DELETE")
File "D:\Download\FBHandler\venv\lib\site-packages\facebook\__init__.py", line 299, in request
raise GraphAPIError(result)
facebook.GraphAPIError: (#200) The user hasn't authorized the application to perform this action
https://developers.facebook.com/docs/graph-api/reference/v3.3/post#deleting
An app can delete any post it published, or a page-management app can delete a Post published to a Page that the app manages.
如果 post 不是由该 App 创建的,则无法删除它。