|
1 | 1 | from .client import Client, AsyncClient |
2 | 2 | from .v2.client import V2Client, AsyncV2Client |
| 3 | +import typing |
| 4 | +from .environment import ClientEnvironment |
| 5 | +import os |
| 6 | +import httpx |
| 7 | +from concurrent.futures import ThreadPoolExecutor |
3 | 8 |
|
4 | 9 |
|
5 | 10 | class ClientV2(V2Client, Client): # type: ignore |
6 | | - __init__ = Client.__init__ # type: ignore |
| 11 | + def __init__( |
| 12 | + self, |
| 13 | + api_key: typing.Optional[typing.Union[str, |
| 14 | + typing.Callable[[], str]]] = None, |
| 15 | + *, |
| 16 | + base_url: typing.Optional[str] = os.getenv("CO_API_URL"), |
| 17 | + environment: ClientEnvironment = ClientEnvironment.PRODUCTION, |
| 18 | + client_name: typing.Optional[str] = None, |
| 19 | + timeout: typing.Optional[float] = None, |
| 20 | + httpx_client: typing.Optional[httpx.Client] = None, |
| 21 | + thread_pool_executor: ThreadPoolExecutor = ThreadPoolExecutor(64), |
| 22 | + log_warning_experimental_features: bool = True, |
| 23 | + ): |
| 24 | + Client.__init__( |
| 25 | + self, |
| 26 | + api_key=api_key, |
| 27 | + base_url=base_url, |
| 28 | + environment=environment, |
| 29 | + client_name=client_name, |
| 30 | + timeout=timeout, |
| 31 | + httpx_client=httpx_client, |
| 32 | + thread_pool_executor=thread_pool_executor, |
| 33 | + log_warning_experimental_features=log_warning_experimental_features, |
| 34 | + ) |
7 | 35 |
|
8 | 36 |
|
9 | 37 | class AsyncClientV2(AsyncV2Client, AsyncClient): # type: ignore |
10 | | - __init__ = AsyncClient.__init__ # type: ignore |
| 38 | + def __init__( |
| 39 | + self, |
| 40 | + api_key: typing.Optional[typing.Union[str, |
| 41 | + typing.Callable[[], str]]] = None, |
| 42 | + *, |
| 43 | + base_url: typing.Optional[str] = os.getenv("CO_API_URL"), |
| 44 | + environment: ClientEnvironment = ClientEnvironment.PRODUCTION, |
| 45 | + client_name: typing.Optional[str] = None, |
| 46 | + timeout: typing.Optional[float] = None, |
| 47 | + httpx_client: typing.Optional[httpx.AsyncClient] = None, |
| 48 | + thread_pool_executor: ThreadPoolExecutor = ThreadPoolExecutor(64), |
| 49 | + log_warning_experimental_features: bool = True, |
| 50 | + ): |
| 51 | + AsyncClient.__init__( |
| 52 | + self, |
| 53 | + api_key=api_key, |
| 54 | + base_url=base_url, |
| 55 | + environment=environment, |
| 56 | + client_name=client_name, |
| 57 | + timeout=timeout, |
| 58 | + httpx_client=httpx_client, |
| 59 | + thread_pool_executor=thread_pool_executor, |
| 60 | + log_warning_experimental_features=log_warning_experimental_features, |
| 61 | + ) |
0 commit comments