mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-04-26 10:41:14 +00:00
Some checks failed
Auto Create GitHub Release on Version Change / check-version-change (push) Waiting to run
Auto Create GitHub Release on Version Change / create-release (push) Blocked by required conditions
Run tests and pre-commit / Run tests and pre-commit hooks (push) Waiting to run
Run tests and pre-commit / Frontend Lint and Build (push) Waiting to run
Publish Fern Docs / run (push) Waiting to run
Build Skyvern SDK and publish to PyPI / check-version-change (push) Waiting to run
Build Skyvern SDK and publish to PyPI / run-ci (push) Blocked by required conditions
Build Skyvern SDK and publish to PyPI / build-sdk (push) Blocked by required conditions
Build Skyvern TS SDK and publish to npm / check-version-change (push) Waiting to run
Build Skyvern TS SDK and publish to npm / build-and-publish-sdk (push) Blocked by required conditions
zizmor / Audit GitHub Actions (push) Has been cancelled
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
80 lines
2.4 KiB
Python
80 lines
2.4 KiB
Python
# This file was auto-generated by Fern from our API Definition.
|
|
|
|
import typing
|
|
|
|
import httpx
|
|
from .http_client import AsyncHttpClient, HttpClient
|
|
|
|
|
|
class BaseClientWrapper:
|
|
def __init__(
|
|
self,
|
|
*,
|
|
api_key: typing.Optional[str] = None,
|
|
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
base_url: str,
|
|
timeout: typing.Optional[float] = None,
|
|
):
|
|
self._api_key = api_key
|
|
self._headers = headers
|
|
self._base_url = base_url
|
|
self._timeout = timeout
|
|
|
|
def get_headers(self) -> typing.Dict[str, str]:
|
|
headers: typing.Dict[str, str] = {
|
|
"User-Agent": "skyvern/1.0.27",
|
|
"X-Fern-Language": "Python",
|
|
"X-Fern-SDK-Name": "skyvern",
|
|
"X-Fern-SDK-Version": "1.0.27",
|
|
**(self.get_custom_headers() or {}),
|
|
}
|
|
if self._api_key is not None:
|
|
headers["x-api-key"] = self._api_key
|
|
return headers
|
|
|
|
def get_custom_headers(self) -> typing.Optional[typing.Dict[str, str]]:
|
|
return self._headers
|
|
|
|
def get_base_url(self) -> str:
|
|
return self._base_url
|
|
|
|
def get_timeout(self) -> typing.Optional[float]:
|
|
return self._timeout
|
|
|
|
|
|
class SyncClientWrapper(BaseClientWrapper):
|
|
def __init__(
|
|
self,
|
|
*,
|
|
api_key: typing.Optional[str] = None,
|
|
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
base_url: str,
|
|
timeout: typing.Optional[float] = None,
|
|
httpx_client: httpx.Client,
|
|
):
|
|
super().__init__(api_key=api_key, headers=headers, base_url=base_url, timeout=timeout)
|
|
self.httpx_client = HttpClient(
|
|
httpx_client=httpx_client,
|
|
base_headers=self.get_headers,
|
|
base_timeout=self.get_timeout,
|
|
base_url=self.get_base_url,
|
|
)
|
|
|
|
|
|
class AsyncClientWrapper(BaseClientWrapper):
|
|
def __init__(
|
|
self,
|
|
*,
|
|
api_key: typing.Optional[str] = None,
|
|
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
base_url: str,
|
|
timeout: typing.Optional[float] = None,
|
|
httpx_client: httpx.AsyncClient,
|
|
):
|
|
super().__init__(api_key=api_key, headers=headers, base_url=base_url, timeout=timeout)
|
|
self.httpx_client = AsyncHttpClient(
|
|
httpx_client=httpx_client,
|
|
base_headers=self.get_headers,
|
|
base_timeout=self.get_timeout,
|
|
base_url=self.get_base_url,
|
|
)
|