From 78ad5c65e510ba3f16593076635e0af25faa95b2 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 7 Jul 2025 21:39:00 +0000 Subject: [PATCH 1/2] SDK regeneration --- src/pipedream/client.py | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/pipedream/client.py b/src/pipedream/client.py index 58505a9..bb9de62 100644 --- a/src/pipedream/client.py +++ b/src/pipedream/client.py @@ -1,5 +1,6 @@ # This file was auto-generated by Fern from our API Definition. +import os import typing import httpx @@ -8,6 +9,7 @@ from .app_categories.client import AppCategoriesClient, AsyncAppCategoriesClient from .apps.client import AppsClient, AsyncAppsClient from .components.client import AsyncComponentsClient, ComponentsClient +from .core.api_error import ApiError from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from .core.oauth_token_provider import OAuthTokenProvider from .deployed_triggers.client import AsyncDeployedTriggersClient, DeployedTriggersClient @@ -40,8 +42,8 @@ class Client: project_id : str x_pd_environment : typing.Optional[str] - client_id : str - client_secret : str + client_id : typing.Optional[str] + client_secret : typing.Optional[str] _token_getter_override : typing.Optional[typing.Callable[[], str]] timeout : typing.Optional[float] The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced. @@ -71,8 +73,8 @@ def __init__( environment: PipedreamEnvironment = PipedreamEnvironment.PROD, project_id: str, x_pd_environment: typing.Optional[str] = None, - client_id: str, - client_secret: str, + client_id: typing.Optional[str] = os.getenv("PIPEDREAM_CLIENT_ID"), + client_secret: typing.Optional[str] = os.getenv("PIPEDREAM_CLIENT_SECRET"), _token_getter_override: typing.Optional[typing.Callable[[], str]] = None, timeout: typing.Optional[float] = None, follow_redirects: typing.Optional[bool] = True, @@ -81,6 +83,14 @@ def __init__( _defaulted_timeout = ( timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read ) + if client_id is None: + raise ApiError( + body="The client must be instantiated be either passing in client_id or setting PIPEDREAM_CLIENT_ID" + ) + if client_secret is None: + raise ApiError( + body="The client must be instantiated be either passing in client_secret or setting PIPEDREAM_CLIENT_SECRET" + ) oauth_token_provider = OAuthTokenProvider( client_id=client_id, client_secret=client_secret, @@ -140,8 +150,8 @@ class AsyncClient: project_id : str x_pd_environment : typing.Optional[str] - client_id : str - client_secret : str + client_id : typing.Optional[str] + client_secret : typing.Optional[str] _token_getter_override : typing.Optional[typing.Callable[[], str]] timeout : typing.Optional[float] The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced. @@ -171,8 +181,8 @@ def __init__( environment: PipedreamEnvironment = PipedreamEnvironment.PROD, project_id: str, x_pd_environment: typing.Optional[str] = None, - client_id: str, - client_secret: str, + client_id: typing.Optional[str] = os.getenv("PIPEDREAM_CLIENT_ID"), + client_secret: typing.Optional[str] = os.getenv("PIPEDREAM_CLIENT_SECRET"), _token_getter_override: typing.Optional[typing.Callable[[], str]] = None, timeout: typing.Optional[float] = None, follow_redirects: typing.Optional[bool] = True, @@ -181,6 +191,14 @@ def __init__( _defaulted_timeout = ( timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read ) + if client_id is None: + raise ApiError( + body="The client must be instantiated be either passing in client_id or setting PIPEDREAM_CLIENT_ID" + ) + if client_secret is None: + raise ApiError( + body="The client must be instantiated be either passing in client_secret or setting PIPEDREAM_CLIENT_SECRET" + ) oauth_token_provider = OAuthTokenProvider( client_id=client_id, client_secret=client_secret, From 8de12dbc001a8b1090cb61c395ec1232e291e623 Mon Sep 17 00:00:00 2001 From: Jay Vercellone Date: Mon, 7 Jul 2025 14:40:42 -0700 Subject: [PATCH 2/2] Remove unnecessary code --- src/pipedream/pipedream.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/pipedream/pipedream.py b/src/pipedream/pipedream.py index c6b0ccd..14b426f 100644 --- a/src/pipedream/pipedream.py +++ b/src/pipedream/pipedream.py @@ -18,12 +18,8 @@ def __init__( client_id: Optional[str] = None, client_secret: Optional[str] = None, ): - self.client_id = client_id or os.getenv("PIPEDREAM_CLIENT_ID") - self.client_secret = client_secret or os.getenv( - "PIPEDREAM_CLIENT_SECRET") - - if not self.client_id or not self.client_secret: - raise ValueError("OAuth client ID and secret are required") + self.client_id = client_id + self.client_secret = client_secret class Pipedream(Client): @@ -41,9 +37,6 @@ def __init__( if not project_id: raise ValueError("Project ID is required") - if not credentials.client_id or not credentials.client_secret: - raise ValueError("OAuth client ID and secret are required") - super().__init__( client_id=credentials.client_id, client_secret=credentials.client_secret, @@ -69,9 +62,6 @@ def __init__( if not project_id: raise ValueError("Project ID is required") - if not credentials.client_id or not credentials.client_secret: - raise ValueError("OAuth client ID and secret are required") - super().__init__( client_id=credentials.client_id, client_secret=credentials.client_secret,