Skip to content

Commit 8954d97

Browse files
committed
SDK regeneration
1 parent 1c73992 commit 8954d97

File tree

2 files changed

+21
-39
lines changed

2 files changed

+21
-39
lines changed

src/pipedream/client.py

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# This file was auto-generated by Fern from our API Definition.
22

3-
import os
43
import typing
54

65
import httpx
@@ -9,7 +8,6 @@
98
from .app_categories.client import AppCategoriesClient, AsyncAppCategoriesClient
109
from .apps.client import AppsClient, AsyncAppsClient
1110
from .components.client import AsyncComponentsClient, ComponentsClient
12-
from .core.api_error import ApiError
1311
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
1412
from .core.oauth_token_provider import OAuthTokenProvider
1513
from .deployed_triggers.client import AsyncDeployedTriggersClient, DeployedTriggersClient
@@ -42,8 +40,8 @@ class Client:
4240
4341
project_id : str
4442
x_pd_environment : typing.Optional[str]
45-
client_id : typing.Optional[str]
46-
client_secret : typing.Optional[str]
43+
client_id : str
44+
client_secret : str
4745
_token_getter_override : typing.Optional[typing.Callable[[], str]]
4846
timeout : typing.Optional[float]
4947
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.
@@ -73,8 +71,8 @@ def __init__(
7371
environment: PipedreamEnvironment = PipedreamEnvironment.PROD,
7472
project_id: str,
7573
x_pd_environment: typing.Optional[str] = None,
76-
client_id: typing.Optional[str] = os.getenv("PIPEDREAM_CLIENT_ID"),
77-
client_secret: typing.Optional[str] = os.getenv("PIPEDREAM_CLIENT_SECRET"),
74+
client_id: str,
75+
client_secret: str,
7876
_token_getter_override: typing.Optional[typing.Callable[[], str]] = None,
7977
timeout: typing.Optional[float] = None,
8078
follow_redirects: typing.Optional[bool] = True,
@@ -83,14 +81,6 @@ def __init__(
8381
_defaulted_timeout = (
8482
timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
8583
)
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-
)
9484
oauth_token_provider = OAuthTokenProvider(
9585
client_id=client_id,
9686
client_secret=client_secret,
@@ -150,8 +140,8 @@ class AsyncClient:
150140
151141
project_id : str
152142
x_pd_environment : typing.Optional[str]
153-
client_id : typing.Optional[str]
154-
client_secret : typing.Optional[str]
143+
client_id : str
144+
client_secret : str
155145
_token_getter_override : typing.Optional[typing.Callable[[], str]]
156146
timeout : typing.Optional[float]
157147
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.
@@ -181,8 +171,8 @@ def __init__(
181171
environment: PipedreamEnvironment = PipedreamEnvironment.PROD,
182172
project_id: str,
183173
x_pd_environment: typing.Optional[str] = None,
184-
client_id: typing.Optional[str] = os.getenv("PIPEDREAM_CLIENT_ID"),
185-
client_secret: typing.Optional[str] = os.getenv("PIPEDREAM_CLIENT_SECRET"),
174+
client_id: str,
175+
client_secret: str,
186176
_token_getter_override: typing.Optional[typing.Callable[[], str]] = None,
187177
timeout: typing.Optional[float] = None,
188178
follow_redirects: typing.Optional[bool] = True,
@@ -191,14 +181,6 @@ def __init__(
191181
_defaulted_timeout = (
192182
timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
193183
)
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-
)
202184
oauth_token_provider = OAuthTokenProvider(
203185
client_id=client_id,
204186
client_secret=client_secret,

src/pipedream/core/client_wrapper.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ def __init__(
1212
*,
1313
project_id: str,
1414
x_pd_environment: typing.Optional[str] = None,
15-
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
15+
access_token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
1616
headers: typing.Optional[typing.Dict[str, str]] = None,
1717
base_url: str,
1818
timeout: typing.Optional[float] = None,
1919
):
2020
self._project_id = project_id
2121
self._x_pd_environment = x_pd_environment
22-
self._token = token
22+
self._access_token = access_token
2323
self._headers = headers
2424
self._base_url = base_url
2525
self._timeout = timeout
@@ -34,16 +34,16 @@ def get_headers(self) -> typing.Dict[str, str]:
3434
}
3535
if self._x_pd_environment is not None:
3636
headers["x-pd-environment"] = self._x_pd_environment
37-
token = self._get_token()
38-
if token is not None:
39-
headers["Authorization"] = f"Bearer {token}"
37+
access_token = self._get_access_token()
38+
if access_token is not None:
39+
headers["Authorization"] = f"Bearer {access_token}"
4040
return headers
4141

42-
def _get_token(self) -> typing.Optional[str]:
43-
if isinstance(self._token, str) or self._token is None:
44-
return self._token
42+
def _get_access_token(self) -> typing.Optional[str]:
43+
if isinstance(self._access_token, str) or self._access_token is None:
44+
return self._access_token
4545
else:
46-
return self._token()
46+
return self._access_token()
4747

4848
def get_custom_headers(self) -> typing.Optional[typing.Dict[str, str]]:
4949
return self._headers
@@ -61,7 +61,7 @@ def __init__(
6161
*,
6262
project_id: str,
6363
x_pd_environment: typing.Optional[str] = None,
64-
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
64+
access_token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
6565
headers: typing.Optional[typing.Dict[str, str]] = None,
6666
base_url: str,
6767
timeout: typing.Optional[float] = None,
@@ -70,7 +70,7 @@ def __init__(
7070
super().__init__(
7171
project_id=project_id,
7272
x_pd_environment=x_pd_environment,
73-
token=token,
73+
access_token=access_token,
7474
headers=headers,
7575
base_url=base_url,
7676
timeout=timeout,
@@ -89,7 +89,7 @@ def __init__(
8989
*,
9090
project_id: str,
9191
x_pd_environment: typing.Optional[str] = None,
92-
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
92+
access_token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
9393
headers: typing.Optional[typing.Dict[str, str]] = None,
9494
base_url: str,
9595
timeout: typing.Optional[float] = None,
@@ -98,7 +98,7 @@ def __init__(
9898
super().__init__(
9999
project_id=project_id,
100100
x_pd_environment=x_pd_environment,
101-
token=token,
101+
access_token=access_token,
102102
headers=headers,
103103
base_url=base_url,
104104
timeout=timeout,

0 commit comments

Comments
 (0)