Skip to content

Commit 267f88e

Browse files
committed
feat: add User-Agent header to HTTP clients in io.py and websocket.py
1 parent 5707c25 commit 267f88e

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/fish_audio_sdk/io.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,20 @@ def __init__(self, apikey: str, *, base_url: str = "https://api.fish.audio"):
3434
def init_async_client(self):
3535
self._async_client = httpx.AsyncClient(
3636
base_url=self._base_url,
37-
headers={"Authorization": f"Bearer {self._apikey}"},
37+
headers={
38+
"Authorization": f"Bearer {self._apikey}",
39+
"User-Agent": "fish-audio/python/legacy",
40+
},
3841
timeout=None,
3942
)
4043

4144
def init_sync_client(self):
4245
self._sync_client = httpx.Client(
4346
base_url=self._base_url,
44-
headers={"Authorization": f"Bearer {self._apikey}"},
47+
headers={
48+
"Authorization": f"Bearer {self._apikey}",
49+
"User-Agent": "fish-audio/python/legacy",
50+
},
4551
timeout=None,
4652
)
4753

src/fish_audio_sdk/websocket.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ def __init__(
2424
self._executor = ThreadPoolExecutor(max_workers=max_workers)
2525
self._client = httpx.Client(
2626
base_url=self._base_url,
27-
headers={"Authorization": f"Bearer {self._apikey}"},
27+
headers={
28+
"Authorization": f"Bearer {self._apikey}",
29+
"User-Agent": "fish-audio/python/legacy",
30+
},
2831
)
2932

3033
def __enter__(self):
@@ -97,7 +100,10 @@ def __init__(
97100
self._base_url = base_url
98101
self._client = httpx.AsyncClient(
99102
base_url=self._base_url,
100-
headers={"Authorization": f"Bearer {self._apikey}"},
103+
headers={
104+
"Authorization": f"Bearer {self._apikey}",
105+
"User-Agent": "fish-audio/python/legacy",
106+
},
101107
)
102108

103109
async def __aenter__(self):

0 commit comments

Comments
 (0)