Skip to content

Commit 4689a96

Browse files
Bugfix refactor and improvements (#246)
* Refactor the Proxy interface so that it handles any response type (including JSON) * Fix how the Proxy handles redirects and other non-successful status codes by avoiding to parse non-JSON payloads * Improve the Proxy interface so that the query params don't have to be manually encoded in the `url` argument, by using the existing `params` argument (which was previously ignored) * Add the new `emit_on_deploy` flag as an argument to the "deploy trigger" endpoint --------- Co-authored-by: fern-api[bot] <115122769+fern-api[bot]@users.noreply.github.com> Co-authored-by: Jay Vercellone <jay@pipedream.com>
1 parent c101490 commit 4689a96

File tree

22 files changed

+1109
-630
lines changed

22 files changed

+1109
-630
lines changed

.fernignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ src/pipedream/pipedream.py
1818

1919
# Custom Proxy files
2020
src/pipedream/proxy/client.py
21+
src/pipedream/proxy/raw_client.py
2122

2223
# Custom Workflow files
2324
src/pipedream/workflows/__init__.py

README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55

66
The Pipedream Python library provides convenient access to the Pipedream APIs from Python.
77

8+
## Table of Contents
9+
10+
- [Installation](#installation)
11+
- [Reference](#reference)
12+
- [Usage](#usage)
13+
- [Async Client](#async-client)
14+
- [Exception Handling](#exception-handling)
15+
- [Pagination](#pagination)
16+
- [Advanced](#advanced)
17+
- [Access Raw Response Data](#access-raw-response-data)
18+
- [Retries](#retries)
19+
- [Timeouts](#timeouts)
20+
- [Custom Client](#custom-client)
21+
- [Contributing](#contributing)
22+
823
## Installation
924

1025
```sh
@@ -89,14 +104,7 @@ client = Pipedream(
89104
client_id="YOUR_CLIENT_ID",
90105
client_secret="YOUR_CLIENT_SECRET",
91106
)
92-
response = client.apps.list(
93-
after="after",
94-
before="before",
95-
limit=1,
96-
q="q",
97-
sort_key="name",
98-
sort_direction="asc",
99-
)
107+
response = client.apps.list()
100108
for item in response:
101109
yield item
102110
# alternatively, you can paginate page-by-page

poetry.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "pipedream"
33

44
[tool.poetry]
55
name = "pipedream"
6-
version = "1.0.11"
6+
version = "1.0.12"
77
description = ""
88
readme = "README.md"
99
authors = []

src/pipedream/accounts/client.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,7 @@ def list(
8282
client_id="YOUR_CLIENT_ID",
8383
client_secret="YOUR_CLIENT_SECRET",
8484
)
85-
response = client.accounts.list(
86-
external_user_id="external_user_id",
87-
oauth_app_id="oauth_app_id",
88-
after="after",
89-
before="before",
90-
limit=1,
91-
app="app",
92-
include_credentials=True,
93-
)
85+
response = client.accounts.list()
9486
for item in response:
9587
yield item
9688
# alternatively, you can paginate page-by-page
@@ -160,8 +152,6 @@ def create(
160152
client_secret="YOUR_CLIENT_SECRET",
161153
)
162154
client.accounts.create(
163-
external_user_id="external_user_id",
164-
oauth_app_id="oauth_app_id",
165155
app_slug="app_slug",
166156
cfmap_json="cfmap_json",
167157
connect_token="connect_token",
@@ -215,7 +205,6 @@ def retrieve(
215205
)
216206
client.accounts.retrieve(
217207
account_id="account_id",
218-
include_credentials=True,
219208
)
220209
"""
221210
_response = self._raw_client.retrieve(
@@ -363,15 +352,7 @@ async def list(
363352
364353
365354
async def main() -> None:
366-
response = await client.accounts.list(
367-
external_user_id="external_user_id",
368-
oauth_app_id="oauth_app_id",
369-
after="after",
370-
before="before",
371-
limit=1,
372-
app="app",
373-
include_credentials=True,
374-
)
355+
response = await client.accounts.list()
375356
async for item in response:
376357
yield item
377358
@@ -450,8 +431,6 @@ async def create(
450431
451432
async def main() -> None:
452433
await client.accounts.create(
453-
external_user_id="external_user_id",
454-
oauth_app_id="oauth_app_id",
455434
app_slug="app_slug",
456435
cfmap_json="cfmap_json",
457436
connect_token="connect_token",
@@ -513,7 +492,6 @@ async def retrieve(
513492
async def main() -> None:
514493
await client.accounts.retrieve(
515494
account_id="account_id",
516-
include_credentials=True,
517495
)
518496
519497

src/pipedream/actions/client.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,7 @@ def list(
8080
client_id="YOUR_CLIENT_ID",
8181
client_secret="YOUR_CLIENT_SECRET",
8282
)
83-
response = client.actions.list(
84-
after="after",
85-
before="before",
86-
limit=1,
87-
q="q",
88-
app="app",
89-
)
83+
response = client.actions.list()
9084
for item in response:
9185
yield item
9286
# alternatively, you can paginate page-by-page
@@ -431,13 +425,7 @@ async def list(
431425
432426
433427
async def main() -> None:
434-
response = await client.actions.list(
435-
after="after",
436-
before="before",
437-
limit=1,
438-
q="q",
439-
app="app",
440-
)
428+
response = await client.actions.list()
441429
async for item in response:
442430
yield item
443431

src/pipedream/actions/raw_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def run(
426426
),
427427
"dynamic_props_id": dynamic_props_id,
428428
"stash_id": convert_and_respect_annotation_metadata(
429-
object_=stash_id, annotation=RunActionOptsStashId, direction="write"
429+
object_=stash_id, annotation=typing.Optional[RunActionOptsStashId], direction="write"
430430
),
431431
},
432432
headers={
@@ -866,7 +866,7 @@ async def run(
866866
),
867867
"dynamic_props_id": dynamic_props_id,
868868
"stash_id": convert_and_respect_annotation_metadata(
869-
object_=stash_id, annotation=RunActionOptsStashId, direction="write"
869+
object_=stash_id, annotation=typing.Optional[RunActionOptsStashId], direction="write"
870870
),
871871
},
872872
headers={

src/pipedream/apps/client.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,7 @@ def list(
8383
client_id="YOUR_CLIENT_ID",
8484
client_secret="YOUR_CLIENT_SECRET",
8585
)
86-
response = client.apps.list(
87-
after="after",
88-
before="before",
89-
limit=1,
90-
q="q",
91-
sort_key="name",
92-
sort_direction="asc",
93-
)
86+
response = client.apps.list()
9487
for item in response:
9588
yield item
9689
# alternatively, you can paginate page-by-page
@@ -219,14 +212,7 @@ async def list(
219212
220213
221214
async def main() -> None:
222-
response = await client.apps.list(
223-
after="after",
224-
before="before",
225-
limit=1,
226-
q="q",
227-
sort_key="name",
228-
sort_direction="asc",
229-
)
215+
response = await client.apps.list()
230216
async for item in response:
231217
yield item
232218

src/pipedream/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import typing
77

88
import httpx
9-
from .types.project_environment import ProjectEnvironment
109
from .core.api_error import ApiError
1110
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
1211
from .core.oauth_token_provider import OAuthTokenProvider
1312
from .environment import PipedreamEnvironment
13+
from .types.project_environment import ProjectEnvironment
1414

1515
if typing.TYPE_CHECKING:
1616
from .accounts.client import AccountsClient, AsyncAccountsClient

src/pipedream/components/client.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,7 @@ def list(
8383
client_id="YOUR_CLIENT_ID",
8484
client_secret="YOUR_CLIENT_SECRET",
8585
)
86-
response = client.components.list(
87-
after="after",
88-
before="before",
89-
limit=1,
90-
q="q",
91-
app="app",
92-
component_type="trigger",
93-
)
86+
response = client.components.list()
9487
for item in response:
9588
yield item
9689
# alternatively, you can paginate page-by-page
@@ -379,14 +372,7 @@ async def list(
379372
380373
381374
async def main() -> None:
382-
response = await client.components.list(
383-
after="after",
384-
before="before",
385-
limit=1,
386-
q="q",
387-
app="app",
388-
component_type="trigger",
389-
)
375+
response = await client.components.list()
390376
async for item in response:
391377
yield item
392378

0 commit comments

Comments
 (0)