1

So basically I'm trying to send video data from a raspberry pi using a python script, to my node js server so I can use the footage on my website

I've tried to use urrlib (which didnt work for this) , and I've used the requests library as you can see below:

import requests
url = 'http://0f0730afe95f.ngrok.io/upload/'

#sending this commented dictionary worked , just an FYI
# data ={
#     "name": "morpheus",
#     "job": "leader"
# }


data = open('test.mp4','rb').read()
r = requests.request('POST',url, files={'media':data})

I had even tried specifying files= {'files':data} which didn't work either

Also there was no error with my post url , as the commented dictionary which I've put up above sent successfully
Removing the .read() after open did not make any difference
test.mp4 is in the same directory as the python script so there's no error with that either. The open method works, only the request does not get sent

Would appreciate any help on this Thanks

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.