S
S
sharkyyy32020-10-14 17:17:59
Python
sharkyyy3, 2020-10-14 17:17:59

How to upload a VK clip?

ay = {'access_token': token, 'v': '5.123'}
r = requests.post('https://api.vk.com/method/shortVideo.create', data=ay,
                         headers=headers)

I get a response:
{'response': {'owner_id': 11111, 'video_id': 111111, 'upload_url': 'https://vu.mycdn.me/upload.do?sig=89ea737665b949045a9ae8f573f68fd22695b917&expires=1602828062932&clientType=13&appId=512000384397&id=2073322662253&userId=0'}}

I'm trying to upload a video from a link in upload_url
upload_url = r.json()['response']['upload_url']
resp = requests.post(upload_url, files={'file': open('1.mp4', 'rb')}, data=ay)

I get error 403 "HTTP Status 403 - Can't get file item containing data"

<html><head><title>Apache Tomcat/7.0.79 (ok11) - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 403 - Can't get file item containing data</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Can't get file item containing data</u></p><p><b>description</b> <u>Access to the specified resource has been forbidden.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.79 (ok11)</h3></body></html>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question