mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-05-01 21:20:19 +00:00
77 lines
2.4 KiB
Python
77 lines
2.4 KiB
Python
# This file was auto-generated by Fern from our API Definition.
|
|
|
|
import typing
|
|
import httpx
|
|
from .http_client import HttpClient
|
|
from .http_client import AsyncHttpClient
|
|
|
|
|
|
class BaseClientWrapper:
|
|
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
|
|
|
|
def get_headers(self) -> typing.Dict[str, str]:
|
|
headers: typing.Dict[str, str] = {
|
|
"X-Fern-Language": "Python",
|
|
"X-Fern-SDK-Name": "skyvern",
|
|
"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:
|
|
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,
|
|
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,
|
|
base_timeout=self.get_timeout,
|
|
base_url=self.get_base_url,
|
|
)
|
|
|
|
|
|
class AsyncClientWrapper(BaseClientWrapper):
|
|
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,
|
|
base_timeout=self.get_timeout,
|
|
base_url=self.get_base_url,
|
|
)
|