11# This file was auto-generated by Fern from our API Definition.
22
3+ import os
34import typing
45
56import httpx
89from .app_categories .client import AppCategoriesClient , AsyncAppCategoriesClient
910from .apps .client import AppsClient , AsyncAppsClient
1011from .components .client import AsyncComponentsClient , ComponentsClient
12+ from .core .api_error import ApiError
1113from .core .client_wrapper import AsyncClientWrapper , SyncClientWrapper
1214from .core .oauth_token_provider import OAuthTokenProvider
1315from .deployed_triggers .client import AsyncDeployedTriggersClient , DeployedTriggersClient
@@ -40,8 +42,8 @@ class Client:
4042
4143 project_id : str
4244 x_pd_environment : typing.Optional[str]
43- client_id : str
44- client_secret : str
45+ client_id : typing.Optional[ str]
46+ client_secret : typing.Optional[ str]
4547 _token_getter_override : typing.Optional[typing.Callable[[], str]]
4648 timeout : typing.Optional[float]
4749 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__(
7173 environment : PipedreamEnvironment = PipedreamEnvironment .PROD ,
7274 project_id : str ,
7375 x_pd_environment : typing .Optional [str ] = None ,
74- client_id : str ,
75- client_secret : str ,
76+ client_id : typing . Optional [ str ] = os . getenv ( "PIPEDREAM_CLIENT_ID" ) ,
77+ client_secret : typing . Optional [ str ] = os . getenv ( "PIPEDREAM_CLIENT_SECRET" ) ,
7678 _token_getter_override : typing .Optional [typing .Callable [[], str ]] = None ,
7779 timeout : typing .Optional [float ] = None ,
7880 follow_redirects : typing .Optional [bool ] = True ,
@@ -81,6 +83,14 @@ def __init__(
8183 _defaulted_timeout = (
8284 timeout if timeout is not None else 60 if httpx_client is None else httpx_client .timeout .read
8385 )
86+ if client_id is None :
87+ raise ApiError (
88+ body = "The client must be instantiated be either passing in client_id or setting PIPEDREAM_CLIENT_ID"
89+ )
90+ if client_secret is None :
91+ raise ApiError (
92+ body = "The client must be instantiated be either passing in client_secret or setting PIPEDREAM_CLIENT_SECRET"
93+ )
8494 oauth_token_provider = OAuthTokenProvider (
8595 client_id = client_id ,
8696 client_secret = client_secret ,
@@ -140,8 +150,8 @@ class AsyncClient:
140150
141151 project_id : str
142152 x_pd_environment : typing.Optional[str]
143- client_id : str
144- client_secret : str
153+ client_id : typing.Optional[ str]
154+ client_secret : typing.Optional[ str]
145155 _token_getter_override : typing.Optional[typing.Callable[[], str]]
146156 timeout : typing.Optional[float]
147157 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__(
171181 environment : PipedreamEnvironment = PipedreamEnvironment .PROD ,
172182 project_id : str ,
173183 x_pd_environment : typing .Optional [str ] = None ,
174- client_id : str ,
175- client_secret : str ,
184+ client_id : typing . Optional [ str ] = os . getenv ( "PIPEDREAM_CLIENT_ID" ) ,
185+ client_secret : typing . Optional [ str ] = os . getenv ( "PIPEDREAM_CLIENT_SECRET" ) ,
176186 _token_getter_override : typing .Optional [typing .Callable [[], str ]] = None ,
177187 timeout : typing .Optional [float ] = None ,
178188 follow_redirects : typing .Optional [bool ] = True ,
@@ -181,6 +191,14 @@ def __init__(
181191 _defaulted_timeout = (
182192 timeout if timeout is not None else 60 if httpx_client is None else httpx_client .timeout .read
183193 )
194+ if client_id is None :
195+ raise ApiError (
196+ body = "The client must be instantiated be either passing in client_id or setting PIPEDREAM_CLIENT_ID"
197+ )
198+ if client_secret is None :
199+ raise ApiError (
200+ body = "The client must be instantiated be either passing in client_secret or setting PIPEDREAM_CLIENT_SECRET"
201+ )
184202 oauth_token_provider = OAuthTokenProvider (
185203 client_id = client_id ,
186204 client_secret = client_secret ,
0 commit comments