Skip to content

Commit e536437

Browse files
chore(client): use correct accept headers for binary data (#1161)
1 parent 7fe8ec3 commit e536437

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/openai/resources/audio/speech.py

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def create(
7878
7979
timeout: Override the client-level default timeout for this request, in seconds
8080
"""
81+
extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
8182
return self._post(
8283
"/audio/speech",
8384
body=maybe_transform(
@@ -149,6 +150,7 @@ async def create(
149150
150151
timeout: Override the client-level default timeout for this request, in seconds
151152
"""
153+
extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
152154
return await self._post(
153155
"/audio/speech",
154156
body=maybe_transform(

src/openai/resources/files.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ def content(
238238
"""
239239
if not file_id:
240240
raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
241+
extra_headers = {"Accept": "application/binary", **(extra_headers or {})}
241242
return self._get(
242243
f"/files/{file_id}/content",
243244
options=make_request_options(
@@ -272,7 +273,6 @@ def retrieve_content(
272273
"""
273274
if not file_id:
274275
raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
275-
extra_headers = {"Accept": "application/json", **(extra_headers or {})}
276276
return self._get(
277277
f"/files/{file_id}/content",
278278
options=make_request_options(
@@ -511,6 +511,7 @@ async def content(
511511
"""
512512
if not file_id:
513513
raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
514+
extra_headers = {"Accept": "application/binary", **(extra_headers or {})}
514515
return await self._get(
515516
f"/files/{file_id}/content",
516517
options=make_request_options(
@@ -545,7 +546,6 @@ async def retrieve_content(
545546
"""
546547
if not file_id:
547548
raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
548-
extra_headers = {"Accept": "application/json", **(extra_headers or {})}
549549
return await self._get(
550550
f"/files/{file_id}/content",
551551
options=make_request_options(

0 commit comments

Comments
 (0)