In my django app, I have a view which accomplishes file upload.The core snippet is like this
...
if (request.method == \'POST\'):
if request.FILES.has_
I am using Python==3.8.2 , Django==3.0.4, djangorestframework==3.11.0
I tried self.client.post
but got a Resolver404
exception.
Following worked for me:
import requests
upload_url='www.some.com/oaisjdoasjd' # your url to upload
with open('/home/xyz/video1.webm', 'rb') as video_file:
# if it was a text file we would perhaps do
# file = video_file.read()
response_upload = requests.put(
upload_url,
data=video_file,
headers={'content-type': 'video/webm'}
)