Реализую возобновляемую загрузку, проблема возникает при непосредственном аплоде чанка.
Вариант 1, как по докам
file = open('C:\\Users\\maxim\\Downloads\\ya.mp4', 'rb')
data = dict(access_token=user.fb_token, upload_phase='transfer',
start_offset=int(kwargs.get('start_offset')), upload_session_id=int(kwargs.get('upload_session_id')),
video_file_chunk=file
)
# optional destination
url = '%s%s/videos' % (self.api_video, user.fb_user_id)
# Headers
headers = {'Content-type': 'multipart/form-data'}
req = requests.post(url=url, data=data, headers=headers)
Что хранится в data и сам url
{'start_offset': 0, 'video_file_chunk': <_io.BufferedReader name='C:\\Users\\maxim\\Downloads\\ya.mp4'>, 'upload_phase': 'transfer', 'upload_session_id': 249691982228348, 'access_tok
en': 'EAAXFFwnmYScBABTx6AT40zg1OcQLpSzPd9RBSYAEwqShNvDHLgFCb7A5FnUkvhZAWo0dzhX0Y6NRZADj50JbFqjExR39gnhWGgbjOfqpfiYPsm71NMwKPI94oFmoJf3cWFjHEUAZAwZDZD
'}
'https://graph-video.facebook.com/v2.8/1151655156896/videos'
Ответ от сервера
{'error': {'code': 100, 'message': "Unsupported post request. Object with ID '1151655156896' does not exist, cannot be loaded due to missing permissions, or does not support this o
peration. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api", 'fbtrace_id': 'FEoBntf5jqV', 'error_subcode': 33, 'type': 'GraphMethodException'
}}
Вариант 2
video_file = {'video_file_chunk': open('C:\\Users\\maxim\\Downloads\\ya.mp4', 'rb')}
data = dict(access_token=user.fb_token, upload_phase='transfer',
start_offset=int(kwargs.get('start_offset')), upload_session_id=int(kwargs.get('upload_session_id')),
)
# optional destination
url = '%s%s/videos' % (self.api_video, user.fb_user_id)
# Headers
headers = {'Content-type': 'multipart/form-data'}
req = requests.post(url=url, files=video_file, data=data, headers=headers)
Ответ от сервера
{'error': {'code': 100, 'message': "Unsupported post request. Object with ID '1151655156896' does not exist, cannot be loaded due to missing permissions, or does not support this o
peration. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api", 'type': 'GraphMethodException', 'fbtrace_id': 'A1KZqqvi5pI', 'error_subcode': 33
}}
Разрешения приложения:
user_videos,publish_actions
Пользователю присвоен статус разработчика от приложения.