我的网址,在那里我需要发送一个视频文件。 为此,我写了这个代码:
import requests
upload_url = 'https://cs506200.vk.me/upload_video_new.php?act=add_video&mid=21844505&oid=21844505&vid=171170813&fid=0&tag=93bb46ee&hash=e238f469a32fe7eee85a&swfupload=1&api=1'
file_ = {'file': ('video.mp4', open('video.mp4', 'rb'))}
r = requests.post(upload_url, files=file_)
print (r.text)
我得到一个错误:{“错误”:“无效的文件”}
但是,在这种情况下:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<form enctype="multipart/form-data" action="https://cs506200.vk.me/upload_video_new.php?act=add_video&mid=21844505&oid=21844505&vid=171170813&fid=0&tag=93bb46ee&hash=e238f469a32fe7eee85a&swfupload=1&api=1" method="POST" target="_blank">
<input type="file" name="video_file" />
<input type="submit" value="submit" name="submit" />
</form>
</body>
</html>
所有工作的罚款。 我究竟做错了什么?