update autogenerated client sdk (#2010)

This commit is contained in:
Shuchang Zheng
2025-03-27 22:54:35 -07:00
committed by GitHub
parent 13b0d314a8
commit 4e7dd87f99
94 changed files with 3691 additions and 5149 deletions

View File

@@ -7,7 +7,16 @@ from .http_client import AsyncHttpClient
class BaseClientWrapper:
def __init__(self, *, base_url: str, timeout: typing.Optional[float] = None):
def __init__(
self,
*,
api_key: typing.Optional[str] = None,
authorization: typing.Optional[str] = None,
base_url: str,
timeout: typing.Optional[float] = None,
):
self._api_key = api_key
self._authorization = authorization
self._base_url = base_url
self._timeout = timeout
@@ -15,8 +24,12 @@ class BaseClientWrapper:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "skyvern",
"X-Fern-SDK-Version": "0.1.56",
"X-Fern-SDK-Version": "0.1.65",
}
if self._api_key is not None:
headers["x-api-key"] = self._api_key
if self._authorization is not None:
headers["authorization"] = self._authorization
return headers
def get_base_url(self) -> str:
@@ -27,8 +40,16 @@ class BaseClientWrapper:
class SyncClientWrapper(BaseClientWrapper):
def __init__(self, *, base_url: str, timeout: typing.Optional[float] = None, httpx_client: httpx.Client):
super().__init__(base_url=base_url, timeout=timeout)
def __init__(
self,
*,
api_key: typing.Optional[str] = None,
authorization: typing.Optional[str] = None,
base_url: str,
timeout: typing.Optional[float] = None,
httpx_client: httpx.Client,
):
super().__init__(api_key=api_key, authorization=authorization, base_url=base_url, timeout=timeout)
self.httpx_client = HttpClient(
httpx_client=httpx_client,
base_headers=self.get_headers,
@@ -38,8 +59,16 @@ class SyncClientWrapper(BaseClientWrapper):
class AsyncClientWrapper(BaseClientWrapper):
def __init__(self, *, base_url: str, timeout: typing.Optional[float] = None, httpx_client: httpx.AsyncClient):
super().__init__(base_url=base_url, timeout=timeout)
def __init__(
self,
*,
api_key: typing.Optional[str] = None,
authorization: typing.Optional[str] = None,
base_url: str,
timeout: typing.Optional[float] = None,
httpx_client: httpx.AsyncClient,
):
super().__init__(api_key=api_key, authorization=authorization, base_url=base_url, timeout=timeout)
self.httpx_client = AsyncHttpClient(
httpx_client=httpx_client,
base_headers=self.get_headers,

View File

@@ -85,8 +85,8 @@ def _retry_timeout(response: httpx.Response, retries: int) -> float:
def _should_retry(response: httpx.Response) -> bool:
retriable_400s = [429, 408, 409]
return response.status_code >= 500 or response.status_code in retriable_400s
retryable_400s = [429, 408, 409]
return response.status_code >= 500 or response.status_code in retryable_400s
def remove_omit_from_dict(
@@ -183,7 +183,7 @@ class HttpClient:
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
request_options: typing.Optional[RequestOptions] = None,
retries: int = 0,
retries: int = 2,
omit: typing.Optional[typing.Any] = None,
) -> httpx.Response:
base_url = self.get_base_url(base_url)
@@ -269,7 +269,7 @@ class HttpClient:
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
request_options: typing.Optional[RequestOptions] = None,
retries: int = 0,
retries: int = 2,
omit: typing.Optional[typing.Any] = None,
) -> typing.Iterator[httpx.Response]:
base_url = self.get_base_url(base_url)
@@ -359,7 +359,7 @@ class AsyncHttpClient:
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
request_options: typing.Optional[RequestOptions] = None,
retries: int = 0,
retries: int = 2,
omit: typing.Optional[typing.Any] = None,
) -> httpx.Response:
base_url = self.get_base_url(base_url)
@@ -445,7 +445,7 @@ class AsyncHttpClient:
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
request_options: typing.Optional[RequestOptions] = None,
retries: int = 0,
retries: int = 2,
omit: typing.Optional[typing.Any] = None,
) -> typing.AsyncIterator[httpx.Response]:
base_url = self.get_base_url(base_url)

View File

@@ -79,7 +79,7 @@ def to_jsonable_with_fallback(
class UniversalBaseModel(pydantic.BaseModel):
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
# Allow fields begining with `model_` to be used in the model
# Allow fields beginning with `model_` to be used in the model
protected_namespaces=(),
) # type: ignore # Pydantic v2
@@ -128,7 +128,7 @@ class UniversalBaseModel(pydantic.BaseModel):
Override the default dict method to `exclude_unset` by default. This function patches
`exclude_unset` to work include fields within non-None default values.
"""
# Note: the logic here is multi-plexed given the levers exposed in Pydantic V1 vs V2
# Note: the logic here is multiplexed given the levers exposed in Pydantic V1 vs V2
# Pydantic V1's .dict can be extremely slow, so we do not want to call it twice.
#
# We'd ideally do the same for Pydantic V2, but it shells out to a library to serialize models