Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@

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

## Table of Contents

- [Installation](#installation)
- [Reference](#reference)
- [Usage](#usage)
- [Async Client](#async-client)
- [Exception Handling](#exception-handling)
- [Pagination](#pagination)
- [Advanced](#advanced)
- [Access Raw Response Data](#access-raw-response-data)
- [Retries](#retries)
- [Timeouts](#timeouts)
- [Custom Client](#custom-client)
- [Contributing](#contributing)

## Installation

```sh
Expand Down Expand Up @@ -89,14 +104,7 @@ client = Pipedream(
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
)
response = client.apps.list(
after="after",
before="before",
limit=1,
q="q",
sort_key="name",
sort_direction="asc",
)
response = client.apps.list()
for item in response:
yield item
# alternatively, you can paginate page-by-page
Expand Down
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "pipedream"

[tool.poetry]
name = "pipedream"
version = "1.0.11"
version = "1.0.12"
description = ""
readme = "README.md"
authors = []
Expand Down
26 changes: 2 additions & 24 deletions src/pipedream/accounts/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,7 @@ def list(
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
)
response = client.accounts.list(
external_user_id="external_user_id",
oauth_app_id="oauth_app_id",
after="after",
before="before",
limit=1,
app="app",
include_credentials=True,
)
response = client.accounts.list()
for item in response:
yield item
# alternatively, you can paginate page-by-page
Expand Down Expand Up @@ -160,8 +152,6 @@ def create(
client_secret="YOUR_CLIENT_SECRET",
)
client.accounts.create(
external_user_id="external_user_id",
oauth_app_id="oauth_app_id",
app_slug="app_slug",
cfmap_json="cfmap_json",
connect_token="connect_token",
Expand Down Expand Up @@ -215,7 +205,6 @@ def retrieve(
)
client.accounts.retrieve(
account_id="account_id",
include_credentials=True,
)
"""
_response = self._raw_client.retrieve(
Expand Down Expand Up @@ -363,15 +352,7 @@ async def list(


async def main() -> None:
response = await client.accounts.list(
external_user_id="external_user_id",
oauth_app_id="oauth_app_id",
after="after",
before="before",
limit=1,
app="app",
include_credentials=True,
)
response = await client.accounts.list()
async for item in response:
yield item

Expand Down Expand Up @@ -450,8 +431,6 @@ async def create(

async def main() -> None:
await client.accounts.create(
external_user_id="external_user_id",
oauth_app_id="oauth_app_id",
app_slug="app_slug",
cfmap_json="cfmap_json",
connect_token="connect_token",
Expand Down Expand Up @@ -513,7 +492,6 @@ async def retrieve(
async def main() -> None:
await client.accounts.retrieve(
account_id="account_id",
include_credentials=True,
)


Expand Down
30 changes: 30 additions & 0 deletions src/pipedream/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,33 @@

# isort: skip_file

import typing
from importlib import import_module

if typing.TYPE_CHECKING:
from .types import ListActionsRequestRegistry
_dynamic_imports: typing.Dict[str, str] = {"ListActionsRequestRegistry": ".types"}


def __getattr__(attr_name: str) -> typing.Any:
module_name = _dynamic_imports.get(attr_name)
if module_name is None:
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
try:
module = import_module(module_name, __package__)
if module_name == f".{attr_name}":
return module
else:
return getattr(module, attr_name)
except ImportError as e:
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
except AttributeError as e:
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e


def __dir__():
lazy_attrs = list(_dynamic_imports.keys())
return sorted(lazy_attrs)


__all__ = ["ListActionsRequestRegistry"]
33 changes: 15 additions & 18 deletions src/pipedream/actions/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ..types.run_action_opts_stash_id import RunActionOptsStashId
from ..types.run_action_response import RunActionResponse
from .raw_client import AsyncRawActionsClient, RawActionsClient
from .types.list_actions_request_registry import ListActionsRequestRegistry

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)
Expand Down Expand Up @@ -40,6 +41,7 @@ def list(
limit: typing.Optional[int] = None,
q: typing.Optional[str] = None,
app: typing.Optional[str] = None,
registry: typing.Optional[ListActionsRequestRegistry] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> SyncPager[Component]:
"""
Expand All @@ -62,13 +64,16 @@ def list(
app : typing.Optional[str]
The ID or name slug of the app to filter the actions

registry : typing.Optional[ListActionsRequestRegistry]
The registry to retrieve actions from. Defaults to 'all' ('public', 'private', or 'all')

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Returns
-------
SyncPager[Component]
actions listed
behaves like registry=all

Examples
--------
Expand All @@ -80,21 +85,15 @@ def list(
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
)
response = client.actions.list(
after="after",
before="before",
limit=1,
q="q",
app="app",
)
response = client.actions.list()
for item in response:
yield item
# alternatively, you can paginate page-by-page
for page in response.iter_pages():
yield page
"""
return self._raw_client.list(
after=after, before=before, limit=limit, q=q, app=app, request_options=request_options
after=after, before=before, limit=limit, q=q, app=app, registry=registry, request_options=request_options
)

def retrieve(
Expand Down Expand Up @@ -386,6 +385,7 @@ async def list(
limit: typing.Optional[int] = None,
q: typing.Optional[str] = None,
app: typing.Optional[str] = None,
registry: typing.Optional[ListActionsRequestRegistry] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncPager[Component]:
"""
Expand All @@ -408,13 +408,16 @@ async def list(
app : typing.Optional[str]
The ID or name slug of the app to filter the actions

registry : typing.Optional[ListActionsRequestRegistry]
The registry to retrieve actions from. Defaults to 'all' ('public', 'private', or 'all')

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Returns
-------
AsyncPager[Component]
actions listed
behaves like registry=all

Examples
--------
Expand All @@ -431,13 +434,7 @@ async def list(


async def main() -> None:
response = await client.actions.list(
after="after",
before="before",
limit=1,
q="q",
app="app",
)
response = await client.actions.list()
async for item in response:
yield item

Expand All @@ -449,7 +446,7 @@ async def main() -> None:
asyncio.run(main())
"""
return await self._raw_client.list(
after=after, before=before, limit=limit, q=q, app=app, request_options=request_options
after=after, before=before, limit=limit, q=q, app=app, registry=registry, request_options=request_options
)

async def retrieve(
Expand Down
Loading
Loading