-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d144668
commit 03edc9a
Showing
2 changed files
with
71 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,61 @@ | ||
from .client import Client, AsyncClient | ||
from .v2.client import V2Client, AsyncV2Client | ||
import typing | ||
from .environment import ClientEnvironment | ||
import os | ||
import httpx | ||
from concurrent.futures import ThreadPoolExecutor | ||
|
||
|
||
class ClientV2(V2Client, Client): # type: ignore | ||
__init__ = Client.__init__ # type: ignore | ||
def __init__( | ||
self, | ||
api_key: typing.Optional[typing.Union[str, | ||
typing.Callable[[], str]]] = None, | ||
*, | ||
base_url: typing.Optional[str] = os.getenv("CO_API_URL"), | ||
environment: ClientEnvironment = ClientEnvironment.PRODUCTION, | ||
client_name: typing.Optional[str] = None, | ||
timeout: typing.Optional[float] = None, | ||
httpx_client: typing.Optional[httpx.Client] = None, | ||
thread_pool_executor: ThreadPoolExecutor = ThreadPoolExecutor(64), | ||
log_warning_experimental_features: bool = True, | ||
): | ||
Client.__init__( | ||
self, | ||
api_key=api_key, | ||
base_url=base_url, | ||
environment=environment, | ||
client_name=client_name, | ||
timeout=timeout, | ||
httpx_client=httpx_client, | ||
thread_pool_executor=thread_pool_executor, | ||
log_warning_experimental_features=log_warning_experimental_features, | ||
) | ||
|
||
|
||
class AsyncClientV2(AsyncV2Client, AsyncClient): # type: ignore | ||
__init__ = AsyncClient.__init__ # type: ignore | ||
def __init__( | ||
self, | ||
api_key: typing.Optional[typing.Union[str, | ||
typing.Callable[[], str]]] = None, | ||
*, | ||
base_url: typing.Optional[str] = os.getenv("CO_API_URL"), | ||
environment: ClientEnvironment = ClientEnvironment.PRODUCTION, | ||
client_name: typing.Optional[str] = None, | ||
timeout: typing.Optional[float] = None, | ||
httpx_client: typing.Optional[httpx.AsyncClient] = None, | ||
thread_pool_executor: ThreadPoolExecutor = ThreadPoolExecutor(64), | ||
log_warning_experimental_features: bool = True, | ||
): | ||
AsyncClient.__init__( | ||
self, | ||
api_key=api_key, | ||
base_url=base_url, | ||
environment=environment, | ||
client_name=client_name, | ||
timeout=timeout, | ||
httpx_client=httpx_client, | ||
thread_pool_executor=thread_pool_executor, | ||
log_warning_experimental_features=log_warning_experimental_features, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters