Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lithic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from ._models import BaseModel
from ._version import __title__, __version__
from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse
from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS
from ._exceptions import (
APIError,
LithicError,
Expand Down Expand Up @@ -70,6 +71,9 @@
"ENVIRONMENTS",
"file_from_path",
"BaseModel",
"DEFAULT_TIMEOUT",
"DEFAULT_MAX_RETRIES",
"DEFAULT_CONNECTION_LIMITS",
]

_setup_logging()
Expand Down
6 changes: 3 additions & 3 deletions src/lithic/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@
extract_response_type,
)
from ._constants import (
DEFAULT_LIMITS,
DEFAULT_TIMEOUT,
MAX_RETRY_DELAY,
DEFAULT_MAX_RETRIES,
INITIAL_RETRY_DELAY,
RAW_RESPONSE_HEADER,
OVERRIDE_CAST_TO_HEADER,
DEFAULT_CONNECTION_LIMITS,
)
from ._streaming import Stream, SSEDecoder, AsyncStream, SSEBytesDecoder
from ._exceptions import (
Expand Down Expand Up @@ -747,7 +747,7 @@ def __init__(
if http_client is not None:
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
else:
limits = DEFAULT_LIMITS
limits = DEFAULT_CONNECTION_LIMITS

if transport is not None:
warnings.warn(
Expand Down Expand Up @@ -1294,7 +1294,7 @@ def __init__(
if http_client is not None:
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
else:
limits = DEFAULT_LIMITS
limits = DEFAULT_CONNECTION_LIMITS

if transport is not None:
warnings.warn(
Expand Down
6 changes: 3 additions & 3 deletions src/lithic/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import LithicError, APIStatusError
from ._base_client import (
DEFAULT_LIMITS,
DEFAULT_MAX_RETRIES,
DEFAULT_CONNECTION_LIMITS,
SyncAPIClient,
AsyncAPIClient,
SyncHttpxClientWrapper,
Expand Down Expand Up @@ -273,7 +273,7 @@ def copy(

http_client = None
else:
if self._limits is not DEFAULT_LIMITS:
if self._limits is not DEFAULT_CONNECTION_LIMITS:
connection_pool_limits = self._limits
else:
connection_pool_limits = None
Expand Down Expand Up @@ -563,7 +563,7 @@ def copy(

http_client = None
else:
if self._limits is not DEFAULT_LIMITS:
if self._limits is not DEFAULT_CONNECTION_LIMITS:
connection_pool_limits = self._limits
else:
connection_pool_limits = None
Expand Down
2 changes: 1 addition & 1 deletion src/lithic/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# default timeout is 1 minute
DEFAULT_TIMEOUT = httpx.Timeout(timeout=60.0, connect=5.0)
DEFAULT_MAX_RETRIES = 2
DEFAULT_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)
DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)

INITIAL_RETRY_DELAY = 0.5
MAX_RETRY_DELAY = 8.0