Skip to content
Merged
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
28 changes: 22 additions & 6 deletions src/finch/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def __init__(
self,
*,
access_token: str | None = None,
client_id: str | None = os.environ.get("FINCH_CLIENT_ID", None),
client_secret: str | None = os.environ.get("FINCH_CLIENT_SECRET", None),
webhook_secret: str | None = os.environ.get("FINCH_WEBHOOK_SECRET", None),
client_id: str | None = None,
client_secret: str | None = None,
webhook_secret: str | None = None,
base_url: Optional[str] = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
max_retries: int = DEFAULT_MAX_RETRIES,
Expand Down Expand Up @@ -96,12 +96,20 @@ def __init__(
- `client_secret` from `FINCH_CLIENT_SECRET`
- `webhook_secret` from `FINCH_WEBHOOK_SECRET`
"""
if access_token is None:
access_token = None
self.access_token = access_token

if client_id is None:
client_id = os.environ.get("FINCH_CLIENT_ID") or None
self.client_id = client_id

if client_secret is None:
client_secret = os.environ.get("FINCH_CLIENT_SECRET") or None
self.client_secret = client_secret

if webhook_secret is None:
webhook_secret = os.environ.get("FINCH_WEBHOOK_SECRET") or None
self.webhook_secret = webhook_secret

if base_url is None:
Expand Down Expand Up @@ -352,9 +360,9 @@ def __init__(
self,
*,
access_token: str | None = None,
client_id: str | None = os.environ.get("FINCH_CLIENT_ID", None),
client_secret: str | None = os.environ.get("FINCH_CLIENT_SECRET", None),
webhook_secret: str | None = os.environ.get("FINCH_WEBHOOK_SECRET", None),
client_id: str | None = None,
client_secret: str | None = None,
webhook_secret: str | None = None,
base_url: Optional[str] = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
max_retries: int = DEFAULT_MAX_RETRIES,
Expand Down Expand Up @@ -385,12 +393,20 @@ def __init__(
- `client_secret` from `FINCH_CLIENT_SECRET`
- `webhook_secret` from `FINCH_WEBHOOK_SECRET`
"""
if access_token is None:
access_token = None
self.access_token = access_token

if client_id is None:
client_id = os.environ.get("FINCH_CLIENT_ID") or None
self.client_id = client_id

if client_secret is None:
client_secret = os.environ.get("FINCH_CLIENT_SECRET") or None
self.client_secret = client_secret

if webhook_secret is None:
webhook_secret = os.environ.get("FINCH_WEBHOOK_SECRET") or None
self.webhook_secret = webhook_secret

if base_url is None:
Expand Down