22
33import os
44from json import JSONDecodeError
5- from typing import Any , Dict , Optional
5+ from typing import Any , Optional
66
77import httpx
88
9- from . ._version import __version__
10- from . .exceptions import (
9+ from fishaudio ._version import __version__
10+ from fishaudio .exceptions import (
1111 APIError ,
1212 AuthenticationError ,
1313 NotFoundError ,
1414 PermissionError ,
1515 RateLimitError ,
1616 ServerError ,
1717)
18+
1819from .request_options import RequestOptions
1920
2021
@@ -32,16 +33,15 @@ def _raise_for_status(response: httpx.Response) -> None:
3233 # Raise specific exception based on status code
3334 if status == 401 :
3435 raise AuthenticationError (status , message , response .text )
35- elif status == 403 :
36+ if status == 403 :
3637 raise PermissionError (status , message , response .text )
37- elif status == 404 :
38+ if status == 404 :
3839 raise NotFoundError (status , message , response .text )
39- elif status == 429 :
40+ if status == 429 :
4041 raise RateLimitError (status , message , response .text )
41- elif status >= 500 :
42+ if status >= 500 :
4243 raise ServerError (status , message , response .text )
43- else :
44- raise APIError (status , message , response .text )
44+ raise APIError (status , message , response .text )
4545
4646
4747class BaseClientWrapper :
@@ -61,8 +61,8 @@ def __init__(
6161 self .base_url = base_url
6262
6363 def get_headers (
64- self , additional_headers : Optional [Dict [str , str ]] = None
65- ) -> Dict [str , str ]:
64+ self , additional_headers : Optional [dict [str , str ]] = None
65+ ) -> dict [str , str ]:
6666 """Build headers including authentication and user agent."""
6767 headers = {
6868 "Authorization" : f"Bearer { self .api_key } " ,
@@ -73,7 +73,7 @@ def get_headers(
7373 return headers
7474
7575 def _prepare_request_kwargs (
76- self , request_options : Optional [RequestOptions ], kwargs : Dict [str , Any ]
76+ self , request_options : Optional [RequestOptions ], kwargs : dict [str , Any ]
7777 ) -> None :
7878 """Prepare request kwargs by merging headers, timeout, and query params."""
7979 # Merge headers
0 commit comments