Skip to content

Commit 4858e11

Browse files
authored
Merge branch 'main' into fern-bot/2025-07-07T19-48Z
2 parents 02887df + 80d2deb commit 4858e11

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

.fernignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
# Specify files that shouldn't be modified by Fern
2+
src/pipedream/pipedream.py

src/pipedream/pipedream.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import os
2+
from string import Template
3+
4+
from .client import (
5+
AsyncClient,
6+
Client,
7+
)
8+
from .environment import PipedreamEnvironment
9+
10+
11+
class Pipedream(Client):
12+
def __init__(
13+
self,
14+
project_id: str,
15+
environment: PipedreamEnvironment = PipedreamEnvironment.PROD,
16+
*args,
17+
**kwargs,
18+
):
19+
super().__init__(base_url=_get_base_url(environment), *args, **kwargs)
20+
self.project_id = project_id
21+
22+
23+
class AsyncPipedream(AsyncClient):
24+
def __init__(
25+
self,
26+
project_id: str,
27+
environment: PipedreamEnvironment = PipedreamEnvironment.PROD,
28+
*args,
29+
**kwargs,
30+
):
31+
super().__init__(base_url=_get_base_url(environment), *args, **kwargs)
32+
self.project_id = project_id
33+
34+
35+
def _get_base_url(environment: PipedreamEnvironment) -> str:
36+
if not environment:
37+
raise Exception("Please pass environment to construct the client")
38+
39+
user = os.getenv("DEV_NAMESPACE", "")
40+
return Template(environment.value).substitute(
41+
{
42+
"user": user,
43+
}
44+
)

0 commit comments

Comments
 (0)