I am trying to upload reel with Graph API using Python.
I’m getting an error every time I try to upload video.
Error:
{"debug_info":
{"retriable":false,"type":"NotAuthorizedError","message":"User not authorized to perform this request"}}
Note: I have given every possible permission to my app and page.
Code:
import requests
import os
import json
Title ="Title of the video"
title = Title
description = title
source = f"F:proj_ytTofbdownloads{Title}.mp4"
files = {'source': open(source, 'rb')}
file_size = os.path.getsize(source)
print("File Size is :", file_size, "bytes")
def Initialize():
url = f"https://graph.facebook.com/v13.0/{page_id}/video_reels?upload_phase=start"
payload = {
'access_token': token,
}
r = requests.post(url, data = payload)
return r.json()["video_id"]
video_id=Initialize()
print(video_id)
def Upload():
url = f"https://rupload.facebook.com/video-upload/v15.0/{video_id}"
payload ={
'access_token': token,
'offset': 0,
'file_size': file_size,
}
r = requests.post(url, files=files, data=payload)
return r.text
print(Upload())
Output:
{"debug_info":{"retriable":false,"type":"NotAuthorizedError","message":"User not authorized to perform this request"}}
2
Answers
Your Upload code seem bit wrong if you refer on documentation
with parameter like this
and then you called it like this
Note: I successfully upload it on fb reels and published it, but I dont what happen the video failed to convert without error notice.
i have the same issue can u help me pls
{"debug_info":{"retriable":false,"type":"NotAuthorizedError","message":"User not authorized to perform this request"}}
this is my code :
import requests
import Config
import json
import time
def Facebook_Reels():
Facebook_Reels()