Skip to content

Commit 1c73992

Browse files
committed
Fixes for the custom client
* Attempt to load credentials from env vars, so that the Fern stuff doesn't complain * Expand env vars in base URLs (Fern is not doing it)
1 parent 68d46fc commit 1c73992

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/pipedream/pipedream.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ def __init__(
1818
client_id: Optional[str] = None,
1919
client_secret: Optional[str] = None,
2020
):
21-
self.client_id = client_id
22-
self.client_secret = client_secret
21+
self.client_id = client_id or os.getenv("PIPEDREAM_CLIENT_ID")
22+
self.client_secret = client_secret or os.getenv(
23+
"PIPEDREAM_CLIENT_SECRET")
2324

2425

2526
class Pipedream(Client):
@@ -38,9 +39,9 @@ def __init__(
3839
raise ValueError("Project ID is required")
3940

4041
super().__init__(
42+
base_url=_get_base_url(api_environment),
4143
client_id=credentials.client_id,
4244
client_secret=credentials.client_secret,
43-
environment=api_environment,
4445
project_id=project_id,
4546
x_pd_environment=environment,
4647
**kwargs,
@@ -63,10 +64,17 @@ def __init__(
6364
raise ValueError("Project ID is required")
6465

6566
super().__init__(
67+
base_url=_get_base_url(api_environment),
6668
client_id=credentials.client_id,
6769
client_secret=credentials.client_secret,
68-
environment=api_environment,
6970
project_id=project_id,
7071
x_pd_environment=environment,
7172
**kwargs,
7273
)
74+
75+
76+
def _get_base_url(environment: PipedreamEnvironment) -> str:
77+
"""
78+
Returns the base URL for the given environment.
79+
"""
80+
return os.path.expandvars(environment.value)

0 commit comments

Comments
 (0)