1
1
# This file was auto-generated by Fern from our API Definition.
2
2
3
+ import os
3
4
import typing
4
5
5
6
import httpx
8
9
from .app_categories .client import AppCategoriesClient , AsyncAppCategoriesClient
9
10
from .apps .client import AppsClient , AsyncAppsClient
10
11
from .components .client import AsyncComponentsClient , ComponentsClient
12
+ from .core .api_error import ApiError
11
13
from .core .client_wrapper import AsyncClientWrapper , SyncClientWrapper
12
14
from .core .oauth_token_provider import OAuthTokenProvider
13
15
from .deployed_triggers .client import AsyncDeployedTriggersClient , DeployedTriggersClient
@@ -40,8 +42,8 @@ class Client:
40
42
41
43
project_id : str
42
44
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]
45
47
_token_getter_override : typing.Optional[typing.Callable[[], str]]
46
48
timeout : typing.Optional[float]
47
49
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__(
71
73
environment : PipedreamEnvironment = PipedreamEnvironment .PROD ,
72
74
project_id : str ,
73
75
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" ) ,
76
78
_token_getter_override : typing .Optional [typing .Callable [[], str ]] = None ,
77
79
timeout : typing .Optional [float ] = None ,
78
80
follow_redirects : typing .Optional [bool ] = True ,
@@ -81,6 +83,14 @@ def __init__(
81
83
_defaulted_timeout = (
82
84
timeout if timeout is not None else 60 if httpx_client is None else httpx_client .timeout .read
83
85
)
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
+ )
84
94
oauth_token_provider = OAuthTokenProvider (
85
95
client_id = client_id ,
86
96
client_secret = client_secret ,
@@ -140,8 +150,8 @@ class AsyncClient:
140
150
141
151
project_id : str
142
152
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]
145
155
_token_getter_override : typing.Optional[typing.Callable[[], str]]
146
156
timeout : typing.Optional[float]
147
157
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__(
171
181
environment : PipedreamEnvironment = PipedreamEnvironment .PROD ,
172
182
project_id : str ,
173
183
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" ) ,
176
186
_token_getter_override : typing .Optional [typing .Callable [[], str ]] = None ,
177
187
timeout : typing .Optional [float ] = None ,
178
188
follow_redirects : typing .Optional [bool ] = True ,
@@ -181,6 +191,14 @@ def __init__(
181
191
_defaulted_timeout = (
182
192
timeout if timeout is not None else 60 if httpx_client is None else httpx_client .timeout .read
183
193
)
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
+ )
184
202
oauth_token_provider = OAuthTokenProvider (
185
203
client_id = client_id ,
186
204
client_secret = client_secret ,
0 commit comments