fix: set accepted user agent for APInex STT
This commit is contained in:
1 parent
2a057a71b0
commit
9cec4f1f14
2 files changed
+2
No files matched your search
@@ -52,6 +52,7 @@ async def transcribe_audio(audio: bytes, content_type: str, api_key: str) -> str
|
||||
"Authorization": f"Bearer {api_key}",
|
||||
"Content-Type": content_type,
|
||||
"Accept": "application/json",
|
||||
"User-Agent": "Mozilla/5.0 (compatible; SocialPostWriterBot/1.0)",
|
||||
}
|
||||
async with aiohttp.ClientSession(timeout=timeout) as session:
|
||||
async with session.post(APINEX_STT_URL, data=audio, headers=headers) as response:
|
||||
|
||||
@@ -61,6 +61,7 @@ class VoiceSttTests(unittest.IsolatedAsyncioTestCase):
|
||||
self.assertEqual(kwargs["data"], b"ogg-data")
|
||||
self.assertEqual(kwargs["headers"]["Content-Type"], "audio/ogg")
|
||||
self.assertEqual(kwargs["headers"]["Authorization"], "Bearer not-logged")
|
||||
self.assertIn("Mozilla/5.0", kwargs["headers"]["User-Agent"])
|
||||
|
||||
async def test_transcribe_raises_on_api_error(self):
|
||||
fake_session = FakeClientSession(FakeResponse(401, {}))
|
||||
|
||||
Reference in new issue
Block a user