-1
私は動作することがわかっているcurlコマンドを持っています。私はそれをPythonに翻訳しようとしましたが、エラーが発生します。curlコールをPythonリクエストに変換する
具体的には、「モデル」フィールドが定義されていないという応答が返されます。フォームデータを定義する適切な方法は何ですか?
カール:
curl \
-F [email protected]_audio_file.mp3 \
-F model=en-US \
-F 'notification=callback' \
-F 'callback=http://your_url.com/transcript_callback'
"https://api.speechmatics.com/v1.0/user/123/jobs/?auth_token=ABC"
のpython:
files = {
'data_file': open('my_audio_file.mp3', 'rb'),
'model': 'en-US',
'notification': 'callback',
'callback': 'http://your_url.com/transcript_callback'
}
requests.post('https://api.speechmatics.com/v1.0/user/123/jobs/?auth_token=ABC', files=files)
あなたはエラーの詳細特異的であった場合、それが役立つだろう:
また、正しいフォームのデータは次のようになります。 – RobertB
@RobertB APIからの単なるエラーです。 'b' {\ n "code":400、\ n "error": "言語を選択していません" \ n} '' –