'how to upload audio files to heroku server using python
i have a python program that records sounds,and creates .wav files of these sounds. now i have .wav files on my local machine. for example, recording1.wav.
now i want to upload these audio files to a herokuapp.com sever (using python code of course), for example:
upload recording1.wav from my local machine to Https://my-personal-Website.herokuapp.com/music (my friend already created one for me.)
so that after, my friend could extract these files from his computer using java script.
how to do this?
i have spent days on this. if i was unclear please say.
currenly this code does not compile because it says 'Payload Too Large': the function that uploads the audio file to the server
Solution 1:[1]
Try this:
import requests
url = "put your URL here"
data = open(r'Path to .wav file', 'rb')}
headers = {'content-type': 'audio/wav'}
r = requests.post(url, data=data, headers=headers)
Chag kasher visamayach!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Kovy Jacob |