0
我試圖在SpeechMatics API上使用多部分數據提交的請求。使用API的多部分/表單數據請求
的API聲明如下在捲曲:
curl -F [email protected]_audio_file.mp3 -F model=en-US "https://api.speechmatics.com/v1.0/user/17518/jobs/?auth_token=<some token>" # transcription
當數據文件被認爲是本地路徑和模式是語言按照這裏的文檔,https://app.speechmatics.com/api-details#getJobs
使用請求庫,我的代碼如下,但似乎無法上傳文件:
import Requests
path = 'https://api.speechmatics.com/v1.0/user/userID/jobs'
token = {'auth_token':<some token>}
data_file = open('F:\\user\\Bern\\Data Files\\audio.flac','rb')
model = 'en-US'
r = requests.post(path,params=token,files={'data_file':data_file,'model':model})
我得到的效應初探200,但文件似乎無法上傳。
嘗試'文件= {「文件」:DATA_FILE,「模式」:模式}' – Juggernaut
嘗試,並沒有工作,捲曲清楚地表明,文件必須與參數「數據文件」被束縛。 – BernardL