Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit80d2deb

Browse files
committed
Custom client
1 parenta3e6a2d commit80d2deb

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

‎.fernignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 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+
importos
2+
fromstringimportTemplate
3+
4+
from .clientimport (
5+
AsyncClient,
6+
Client,
7+
)
8+
from .environmentimportPipedreamEnvironment
9+
10+
11+
classPipedream(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+
classAsyncPipedream(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+
ifnotenvironment:
37+
raiseException("Please pass environment to construct the client")
38+
39+
user=os.getenv("DEV_NAMESPACE","")
40+
returnTemplate(environment.value).substitute(
41+
{
42+
"user":user,
43+
}
44+
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp