### Async Proxy Client Example Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/proxy.md Demonstrates making GET and POST requests using the AsyncPipedream client. Shows how to handle both JSON and streaming responses. ```python import asyncio from pipedream import AsyncPipedream async def main(): client = AsyncPipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # GET request response = await client.proxy.get( url="https://api.example.com/users", external_user_id="user_123", account_id="acc_456", ) # POST request response = await client.proxy.post( url="https://api.example.com/messages", external_user_id="user_123", account_id="acc_456", body={"text": "Hello"}, ) # Handle stream response if isinstance(response, AsyncIterator): async for chunk in response: print(f"Chunk: {chunk}") asyncio.run(main()) ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/CONTRIBUTING.md Installs all necessary dependencies for the project using Poetry. ```bash poetry install ``` -------------------------------- ### Example ConfiguredProps Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/types.md Illustrates how to structure a ConfiguredProps dictionary with sample values for channel ID, message, and reply broadcast. ```python # Example configured_props = { "channel_id": "C123456", "message": "Hello from Pipedream", "reply_broadcast": True, } ``` -------------------------------- ### Install Pipedream with aiohttp extra Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/MIGRATE.md Install the Pipedream SDK with the 'aiohttp' extra to enable the aiohttp-backed async transport. This is an optional dependency. ```bash pip install 'pipedream[aiohttp]' ``` -------------------------------- ### Asynchronous Project Operations Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/projects.md The `AsyncPipedream` client provides asynchronous equivalents for all project management methods. This example demonstrates listing, creating, retrieving, getting info, and updating projects asynchronously. ```python import asyncio from pipedream import AsyncPipedream async def main(): client = AsyncPipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # List projects response = await client.projects.list(limit=20) async for project in response: print(project.name) # Create project project = await client.projects.create( name="New Project", support_email="support@example.com", ) print(f"Created: {project.id}") # Retrieve project project = await client.projects.retrieve("project_123") # Get current project info info = await client.projects.info() # Update project project = await client.projects.update( "project_123", name="Updated Name", ) asyncio.run(main()) ``` -------------------------------- ### Install Pipedream Python Library Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/README.md Install the Pipedream Python library using pip. This is the first step to using the SDK. ```shell pip install pipedream ``` -------------------------------- ### Verify Pipedream SDK Installation Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/CLAUDE.md Run this command after `poetry install --all-extras` to confirm the Pipedream SDK can be imported and initialized. It helps catch issues related to removed types or sub-client shape changes. ```bash poetry run python -c "from pipedream import Pipedream, AsyncPipedream; from pipedream.workflows.client import HTTPAuthType; print('ok')" ``` -------------------------------- ### Basic async usage example Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/pipedream-client.md Demonstrates the basic asynchronous usage of the `AsyncPipedream` client, including initializing the client and iterating through a list of apps. ```APIDOC ### Examples #### Basic async usage ```python import asyncio from pipedream import AsyncPipedream async def main(): client = AsyncPipedream( client_id="your_client_id", client_secret="your_client_secret", project_id="your_project_id", ) # Async iteration response = await client.apps.list(limit=10) async for app in response: print(app.name) asyncio.run(main()) ``` ``` -------------------------------- ### Async pagination example Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/pipedream-client.md Illustrates how to handle asynchronous pagination with the `AsyncPipedream` client, showing how to iterate through all pages and items within those pages. ```APIDOC #### Async pagination ```python import asyncio from pipedream import AsyncPipedream async def main(): client = AsyncPipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) response = await client.apps.list(limit=5) # Iterate through all pages async for page in response.iter_pages(): print(f"Page has {len(page.items)} items") async for item in page: print(item.name) asyncio.run(main()) ``` ``` -------------------------------- ### Async Apps Client Example Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/apps.md Demonstrates how to use the AsyncPipedream client to list apps with async iteration, retrieve a specific app by its slug, and paginate through app lists. ```python import asyncio from pipedream import AsyncPipedream async def main(): client = AsyncPipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # List with async iteration response = await client.apps.list(limit=20) async for app in response: print(app.name) # Retrieve specific app app = await client.apps.retrieve("slack") print(app.name) # Page iteration response = await client.apps.list(limit=5) async for page in response.iter_pages(): print(f"Page items: {len(page.items)}") asyncio.run(main()) ``` -------------------------------- ### client.actions.retrieve Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Get detailed configuration for a specific action by its key. Optionally specify a version. ```APIDOC ## GET /actions/{component_id} ### Description Get detailed configuration for a specific action by its key. ### Method GET ### Endpoint /actions/{component_id} ### Parameters #### Path Parameters - **component_id** (str) - Required - The key that uniquely identifies the component (e.g., 'slack-send-message') #### Query Parameters - **project_id** (str) - Required - The project ID, which starts with `proj_`. - **version** (str) - Optional - Optional semantic version of the component to retrieve (for example '1.0.0') - **request_options** (RequestOptions) - Optional - Request-specific configuration. ### Response #### Success Response (200) - **id** (str) - The unique identifier of the component. - **name** (str) - The name of the component. - **description** (str) - A description of the component. - **version** (str) - The version of the component. - **props** (object) - The properties required by the component. #### Response Example { "id": "slack-send-message", "name": "Send Slack Message", "description": "Sends a message to a Slack channel.", "version": "1.0.0", "props": { "text": { "type": "string", "label": "Message Text" } } } ``` -------------------------------- ### Proxy GET Request Example Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/proxy.md Use the `get` method to forward an authenticated GET request to an external API. You can include query parameters and custom headers. The response can be a parsed JSON object, a binary stream, or empty. ```python from pipedream import Pipedream client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # Simple GET request response = client.proxy.get( url="https://api.example.com/users", external_user_id="user_123", account_id="acc_456", ) # With query parameters response = client.proxy.get( url="https://api.example.com/users", external_user_id="user_123", account_id="acc_456", params={"limit": 10, "offset": 0}, ) # With custom headers response = client.proxy.get( url="https://api.example.com/users", external_user_id="user_123", account_id="acc_456", headers={"Accept": "application/json"}, ) # Handle different response types if isinstance(response, ProxyResponse): print(f"JSON response: {response.data}") elif isinstance(response, Iterator): # Binary data stream for chunk in response: print(f"Received {len(chunk)} bytes") elif response is None: print("Empty response") ``` -------------------------------- ### Get Project Info Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/projects.md Fetches detailed information about the current project, including its ID, workspace ID, and available applications. Use this to get general information about the project context. ```python from pipedream import Pipedream client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) info = client.projects.info() print(f"Project: {info.project_id}") print(f"Workspace: {info.workspace_id}") print(f"Available apps: {len(info.available_apps)}") ``` -------------------------------- ### Proxy POST Request Example Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/proxy.md Use the `post` method to forward an authenticated POST request, optionally including a JSON body, query parameters, and custom headers. Similar to GET, it handles JSON, binary, or empty responses. ```python from pipedream import Pipedream client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # POST with JSON body response = client.proxy.post( url="https://api.example.com/messages", external_user_id="user_123", account_id="acc_456", body={"text": "Hello", "channel": "general"}, ) # With query parameters response = client.proxy.post( url="https://api.example.com/messages", external_user_id="user_123", account_id="acc_456", body={"text": "Hello"}, params={"retry": True}, ) ``` -------------------------------- ### Basic Pipedream SDK Usage Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/README.md Initialize the Pipedream client with your credentials and interact with resources like apps and actions. This example demonstrates listing apps and retrieving a specific action. ```python from pipedream import Pipedream client = Pipedream( client_id="your_client_id", client_secret="your_client_secret", project_id="your_project_id", ) # List apps for app in client.apps.list(limit=10): print(app.name) # Retrieve specific action action = client.actions.retrieve("slack-send-message") print(action.name) # Execute action response = client.actions.run( id="slack-send-message", external_user_id="user_123", configured_props={"channel": "general", "message": "Hello!"}, ) ``` -------------------------------- ### Handle NotFoundError Example Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/errors.md Demonstrates how to catch and handle a NotFoundError when retrieving a non-existent action. ```python from pipedream import Pipedream from pipedream.errors import NotFoundError client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) try: client.actions.retrieve("nonexistent-action") except NotFoundError as e: print(f"Action not found: {e.body}") # body typically contains: {"message": "Not found"} ``` -------------------------------- ### Async Actions Client Example Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/actions.md Demonstrates how to use the AsyncPipedream client to interact with actions, including listing with pagination, retrieving a specific action, configuring properties, and running an action. Requires Pipedream client credentials. ```python import asyncio from pipedream import AsyncPipedream async def main(): client = AsyncPipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # Async list with pagination response = await client.actions.list(limit=10) async for action in response: print(action.name) # Retrieve specific action action = await client.actions.retrieve("slack-send-message") # Configure and run config_response = await client.actions.configure_prop( id="slack-send-message", external_user_id="user_123", prop_name="channel_id", ) run_response = await client.actions.run( id="slack-send-message", external_user_id="user_123", configured_props={"channel_id": "C123", "message": "Test"}, ) asyncio.run(main()) ``` -------------------------------- ### SyncPager Usage Example Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/types.md Demonstrates how to iterate through items and pages using the SyncPager. This is useful for processing paginated data sequentially. ```python # Iterate items pager = client.apps.list(limit=5) for app in pager: print(app.name) # Iterate pages for page in pager.iter_pages(): for app in page.items: print(app.name) ``` -------------------------------- ### Initialize Pipedream Client (v1.x compatible) Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/MIGRATE.md Initialize the Pipedream client using the v1.x constructor signature, which remains compatible with v2.x. This example shows a typical initialization for making action runs. ```python # v1.x — still works in v2.x without modification from pipedream import Pipedream client = Pipedream( project_id="YOUR_PROJECT_ID", client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", ) client.actions.run( id="gitlab-list-commits", external_user_id="external_user_id", configured_props={ "gitlab": {"authProvisionId": "apn_kVh9AoD"}, "projectId": 45672541, "refName": "main", }, ) ``` -------------------------------- ### Async Pipedream SDK Usage Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/README.md Initialize the AsyncPipedream client for asynchronous operations. This example shows how to iterate over apps asynchronously. ```python import asyncio from pipedream import AsyncPipedream async def main(): client = AsyncPipedream( client_id="your_client_id", client_secret="your_client_secret", project_id="your_project_id", ) async for app in await client.apps.list(limit=10): print(app.name) asyncio.run(main()) ``` -------------------------------- ### Async Pipedream Triggers Client Example Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/triggers.md Demonstrates how to initialize the AsyncPipedream client and use its methods to list triggers, retrieve a specific trigger, and emit a test event. Requires asyncio to run. ```python import asyncio from pipedream import AsyncPipedream async def main(): client = AsyncPipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # List triggers response = await client.triggers.list(limit=10) async for trigger in response: print(trigger.name) # Retrieve specific trigger trigger = await client.triggers.retrieve("slack-new-message") # Emit test event emitter = await client.triggers.emit_test( id="slack-new-message", external_user_id="user_123", configured_props={"channel_id": "C123"}, ) asyncio.run(main()) ``` -------------------------------- ### Create Project with Full Configuration Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/projects.md Creates a new Pipedream project with a name and optional configuration for the Connect application, support email, and key authentication testing. Use this for advanced project setup. ```python from pipedream import Pipedream client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # Create with full configuration project = client.projects.create( name="Customer Integration Platform", app_name="Integration Hub", support_email="support@example.com", connect_require_key_auth_test=True, ) ``` -------------------------------- ### AsyncPager Usage Example Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/types.md Shows how to iterate through items and pages asynchronously using AsyncPager. Essential for non-blocking paginated data retrieval. ```python # Iterate items pager = await client.apps.list(limit=5) async for app in pager: print(app.name) # Iterate pages async for page in pager.iter_pages(): for app in page.items: print(app.name) ``` -------------------------------- ### Initialize Pipedream Client with Custom HTTPX Client Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/README.md Customize the underlying `httpx` client for advanced use cases like proxy support or custom transports. This example configures a proxy and local address. ```python import httpx from pipedream import Pipedream client = Pipedream( ..., httpx_client=httpx.Client( proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0"), ), ) ``` -------------------------------- ### Configuration Priority Example Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/configuration.md Demonstrates configuration priority where constructor parameters override environment variables. In this case, the `timeout` set in the constructor takes precedence over the `PIPEDREAM_TIMEOUT` environment variable. ```python import os from pipedream import Pipedream os.environ["PIPEDREAM_TIMEOUT"] = "30" # Constructor parameter takes precedence client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", timeout=60.0, # Uses 60.0, not 30 from env var ) ``` -------------------------------- ### List Apps with Pagination Parameters Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/README.md Example of listing applications using the Pipedream client, specifying various parameters for filtering and sorting. This returns a Pager object. ```python from pipedream import Pipedream client = Pipedream( client_id="", client_secret="", ) client.apps.list( after="after", before="before", limit=1, q="q", sort_key="name", sort_direction="asc", category_ids=[ "category_ids" ], has_components=True, has_actions=True, has_triggers=True, ) ``` -------------------------------- ### Initialize Pipedream Client with Bearer Token Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/pipedream-client.md Initialize the Pipedream client using a bearer token for authentication. This example demonstrates retrieving project details. ```python from pipedream import Pipedream client = Pipedream( access_token="your_bearer_token", project_id="your_project_id", ) response = client.projects.retrieve("project_id") ``` -------------------------------- ### Proxy GET Request Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/proxy.md Makes an asynchronous GET request to a specified URL. The response is automatically parsed if it's a JSON payload. ```APIDOC ## GET /proxy ### Description Makes an asynchronous GET request to a specified URL. The response is automatically parsed if it's a JSON payload. ### Method GET ### Endpoint /proxy ### Parameters #### Query Parameters - **url** (string) - Required - The URL to make the GET request to. - **external_user_id** (string) - Required - The ID of the external user making the request. - **account_id** (string) - Required - The ID of the connected account. ### Request Example ```json { "url": "https://api.example.com/users", "external_user_id": "user_123", "account_id": "acc_456" } ``` ### Response #### Success Response (200) - **status_code** (int) - HTTP status code from upstream API. - **headers** (Dict[str, str]) - Response headers. - **data** (Optional[Any]) - Parsed JSON response body, or raw bytes for non-JSON responses. ``` -------------------------------- ### Initialize and Use Pipedream Client Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/README.md Instantiate the Pipedream client with your credentials and use it to call the 'run' action. Ensure you replace placeholders with your actual client ID and secret. ```python from pipedream import Pipedream client = Pipedream( client_id="", client_secret="", ) client.actions.run( id="id", external_user_id="external_user_id", ) ``` -------------------------------- ### Forward Authenticated GET Request via Proxy Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Forward an authenticated GET request to an external API using an external user's account credentials. Initialize the Pipedream client with your credentials. ```python from pipedream import Pipedream from pipedream.environment import PipedreamEnvironment client = Pipedream( client_id="", client_secret="", environment=PipedreamEnvironment.PROD, ) client.proxy.get( url_64="url_64", external_user_id="external_user_id", account_id="account_id", ) ``` -------------------------------- ### Instantiate Pipedream Client Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/CLAUDE.md Demonstrates how to construct the Pipedream client with project ID and access token, and highlights expected attributes and error handling for missing credentials. ```python Pipedream(project_id="x", access_token="y") ``` -------------------------------- ### Initialize Pipedream Client and Run Action Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Initializes the Pipedream client with credentials and environment, then executes a specified action. Ensure you replace placeholder values with your actual client ID and secret. ```python from pipedream import Pipedream from pipedream.environment import PipedreamEnvironment client = Pipedream( client_id="", client_secret="", environment=PipedreamEnvironment.PROD, ) client.actions.run( id="id", external_user_id="external_user_id", ) ``` -------------------------------- ### client.deployed_triggers.retrieve Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Get details of a specific deployed trigger by its ID. ```APIDOC ## retrieve ### Description Get details of a specific deployed trigger by its ID. ### Parameters #### Path Parameters * **project_id** (str) - Required - The project ID, which starts with `proj_`. * **trigger_id** (str) - Required - The ID of the trigger to retrieve. * **external_user_id** (str) - Required - Your end user ID, for whom you deployed the trigger. #### Query Parameters * **request_options** (Optional[RequestOptions]) - Optional - Request-specific configuration. ### Usage Example ```python client.deployed_triggers.retrieve( trigger_id="trigger_id", external_user_id="external_user_id", ) ``` ``` -------------------------------- ### Retrieve Project Information Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Retrieve project configuration and environment details. The client must be initialized with credentials and environment. ```python from pipedream import Pipedream from pipedream.environment import PipedreamEnvironment client = Pipedream( client_id="", client_secret="", environment=PipedreamEnvironment.PROD, ) client.projects.retrieve_info() ``` -------------------------------- ### delete() Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/proxy.md Forward an authenticated DELETE request. Parameters and returns are identical to GET. ```APIDOC ## delete() ### Description Forward an authenticated DELETE request. ### Method DELETE ### Endpoint [URL provided in the `url` parameter] ### Parameters #### Path Parameters None #### Query Parameters - **params** (Dict[str, Any]) - Optional - Query parameters for the request. #### Request Body None #### Path Parameters - **url** (str) - Required - The target URL for the DELETE request. - **external_user_id** (str) - Required - The external user ID for authentication. - **account_id** (str) - Required - The connected account ID for authentication. - **headers** (Dict[str, Any]) - Optional - Additional headers for the request. ### Request Example ```python response = client.proxy.delete( url="https://api.example.com/users/123", external_user_id="user_123", account_id="acc_456", ) ``` ### Response #### Success Response (200) - **ProxyResponse** (ProxyResponse) - The response from the proxy. - **Iterator[bytes]** (Iterator[bytes]) - An iterator for the response body. - **None** (None) - If the request fails or is not applicable. #### Response Example [Response structure depends on the target API] ``` -------------------------------- ### Initialize Async Pipedream Client Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/README.md Demonstrates how to initialize the asynchronous Pipedream client with your credentials. Use httpx.AsyncClient() if constructing your own. ```python import asyncio from pipedream import AsyncPipedream client = AsyncPipedream( client_id="", client_secret="", ) async def main() -> None: await client.actions.run( id="id", external_user_id="external_user_id", ) asyncio.run(main()) ``` -------------------------------- ### Projects Resource Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/INDEX.md Enables listing, creating, retrieving, getting info, and updating projects. ```APIDOC ## Projects Resource ### Description Enables listing, creating, retrieving, getting info, and updating projects. ### Methods - `list()` - `create(...)` - `retrieve(id: str)` - `info(id: str)` - `update(id: str, ...)` ### Key Types - `Project` - `ProjectInfoResponse` ``` -------------------------------- ### run() Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/actions.md Execute an action with the provided configuration and return results. ```APIDOC ## run() ### Description Execute an action with the provided configuration and return results. ### Method ```python def run( self, *, id: str, external_user_id: str, version: Optional[str] = None, configured_props: Optional[ConfiguredProps] = None, dynamic_props_id: Optional[str] = None, stash_id: Optional[RunActionOptsStashId] = None, request_options: Optional[RequestOptions] = None, ) -> RunActionResponse ``` ### Parameters #### Path Parameters - **id** (str) - Required - The action component ID - **external_user_id** (str) - Required - External user ID that owns the action - **version** (str) - Optional - Action semantic version - **configured_props** (ConfiguredProps) - Optional - Prop values for execution (e.g., {"channel_id": "C123", "message": "hello"}) - **dynamic_props_id** (str) - Optional - Dynamic props ID - **stash_id** (RunActionOptsStashId) - Optional - File stash ID for binary data (from file_stash resource) - **request_options** (RequestOptions) - Optional - Request-specific configuration ### Returns `RunActionResponse` — Result of action execution including status, output data, and execution logs. ### Errors - **BadRequestError** (400) - Invalid or missing configured props - **ApiError** (401) - User not authorized - **ApiError** (5xx) - Action execution failed ### Example ```python from pipedream import Pipedream client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # Execute a Slack action to send a message response = client.actions.run( id="slack-send-message", external_user_id="user_123", configured_props={ "channel_id": "C123456", "message": "Hello from Pipedream!", }, ) print(f"Status: {response.status}") print(f"Output: {response.data}") ``` ``` -------------------------------- ### client.triggers.retrieve Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Get detailed configuration for a specific trigger by its key. Allows specifying a version for the trigger. ```APIDOC ## client.triggers.retrieve ### Description Get detailed configuration for a specific trigger by its key. ### Parameters #### Path Parameters - **project_id** (str) - Required - The project ID, which starts with `proj_`. #### Query Parameters - **component_id** (str) - Required - The key that uniquely identifies the component (e.g., 'slack-send-message') - **version** (str) - Optional - Optional semantic version of the component to retrieve (for example '1.0.0') - **request_options** (RequestOptions) - Optional - Request-specific configuration. ### Request Example ```python client.triggers.retrieve( component_id="component_id", version="1.2.3", ) ``` ### Response #### Success Response (200) - **component** (GetComponentResponse) - Description of the response structure for a single component. ``` -------------------------------- ### Basic Async Pipedream Client Usage Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/pipedream-client.md Demonstrates the basic asynchronous usage of the AsyncPipedream client, including initializing the client with credentials and performing an asynchronous list operation on apps. ```python import asyncio from pipedream import AsyncPipedream async def main(): client = AsyncPipedream( client_id="your_client_id", client_secret="your_client_secret", project_id="your_project_id", ) # Async iteration response = await client.apps.list(limit=10) async for app in response: print(app.name) asyncio.run(main()) ``` -------------------------------- ### retrieve() Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/accounts.md Get the details for a specific connected account. You can optionally include stored credentials in the response. ```APIDOC ## retrieve() ### Description Get the details for a specific connected account. You can optionally include stored credentials in the response. ### Method `GET` (Implied by SDK method) ### Endpoint `/accounts/{account_id}` (Implied by SDK method) ### Parameters #### Path Parameters - **account_id** (str) - Required - Connected account ID #### Query Parameters - **include_credentials** (bool) - Optional - Include stored credentials #### Request Body None ### Response #### Success Response (200) - **Account** - Account details. #### Response Example ```json { "display_name": "Example Account", "app_id": "app_abc123" } ``` #### Errors - **NotFoundError** (404) - Account not found ``` -------------------------------- ### Create Project Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Creates a new project for the authenticated workspace. Requires a project name. ```python from pipedream import Pipedream from pipedream.environment import PipedreamEnvironment client = Pipedream( client_id="", client_secret="", environment=PipedreamEnvironment.PROD, ) client.projects.create( name="name", ) ``` -------------------------------- ### Configure Async Pipedream Client with Custom Async httpx Client and Proxy Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/configuration.md Initialize the `AsyncPipedream` client with a custom `httpx.AsyncClient` that includes proxy settings. This enables all asynchronous SDK requests to be routed through the specified proxy. ```python import httpx from pipedream import AsyncPipedream httpx_client = httpx.AsyncClient( proxy="http://proxy.example.com:8080", ) client = AsyncPipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", httpx_client=httpx_client, ) ``` -------------------------------- ### Retrieve a Specific Deployed Trigger Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Get details of a specific deployed trigger by its ID and external user ID. ```python from pipedream import Pipedream from pipedream.environment import PipedreamEnvironment client = Pipedream( client_id="", client_secret="", environment=PipedreamEnvironment.PROD, ) client.deployed_triggers.retrieve( trigger_id="trigger_id", external_user_id="external_user_id", ) ``` -------------------------------- ### Handle TooManyRequestsError Example Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/errors.md Shows how to handle TooManyRequestsError, increasing max_retries and implementing custom logic for rate-limited scenarios. ```python from pipedream import Pipedream from pipedream.errors import TooManyRequestsError client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", max_retries=5, # Increase retry count for rate-limited scenarios ) try: for i in range(1000): client.apps.list(limit=1) except TooManyRequestsError as e: print(f"Rate limit hit: {e.body}") # Implement exponential backoff or wait ``` -------------------------------- ### Iterating Pages with SyncPager Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/README.md Iterate through pages of results using SyncPager. This example prints the number of items on each page. ```python # Iterate pages for page in pager.iter_pages(): print(f"Page has {len(page.items)} items") ``` -------------------------------- ### Initialize Pipedream Client with v2.x Optional Arguments Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/MIGRATE.md Initialize the Pipedream client using v2.x, leveraging new optional keyword arguments like `headers`, `max_retries`, `follow_redirects`, `httpx_client`, and `logging` directly on the wrapper constructor. ```python # v2.x — new optional kwargs available directly on the wrapper import httpx from pipedream import Pipedream client = Pipedream( project_id="YOUR_PROJECT_ID", client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", headers={"X-My-Custom-Header": "value"}, max_retries=0, follow_redirects=True, httpx_client=httpx.Client(timeout=30.0), logging={"level": "info"}, ) ``` -------------------------------- ### client.accounts.retrieve Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Get the details for a specific connected account. Requires account ID and project ID, with an option to include credentials. ```APIDOC ## client.accounts.retrieve ### Description Get the details for a specific connected account. Requires account ID and project ID, with an option to include credentials. ### Parameters #### Path Parameters - **project_id** (str) - Required - The project ID, which starts with `proj_`. #### Query Parameters - **account_id** (str) - Required - - **include_credentials** (bool) - Optional - Whether to retrieve the account's credentials or not - **request_options** (RequestOptions) - Optional - Request-specific configuration. ``` -------------------------------- ### Initialize Pipedream Client and Deploy Trigger Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md This snippet shows how to initialize the Pipedream client with your credentials and environment, and then deploy a trigger. Ensure you replace placeholder values with your actual client ID and secret. ```python from pipedream import Pipedream from pipedream.environment import PipedreamEnvironment client = Pipedream( client_id="", client_secret="", environment=PipedreamEnvironment.PROD, ) client.triggers.deploy( id="id", external_user_id="external_user_id", ) ``` -------------------------------- ### Projects Resource Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/README.md List and manage Pipedream projects. Supports listing, creating, retrieving, updating, and getting info about projects. ```APIDOC ## Projects Resource List and manage Pipedream projects. **Methods:** - `list()` — List projects - `create()` — Create a new project - `retrieve()` — Get project details - `info()` — Get current project info - `update()` — Update project **Types:** `Project`, `ProjectInfoResponse` ``` -------------------------------- ### Retrieve Account Details Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/accounts.md Get the details for a specific connected account. Use `include_credentials=True` to also fetch stored credentials. ```python from pipedream import Pipedream client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # Get account details account = client.accounts.retrieve("acc_123") print(f"Account: {account.display_name}") print(f"App: {account.app_id}") # With credentials (if available) account = client.accounts.retrieve( "acc_123", include_credentials=True, ) ``` -------------------------------- ### client.projects.create Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Creates a new project for the authenticated workspace. Requires a project name. ```APIDOC ## client.projects.create ### Description Creates a new project for the authenticated workspace. ### Method POST ### Endpoint /v1/projects ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **name** (string) - Required - Name of the project - **app_name** (string) - Optional - Display name for the Connect application - **support_email** (string) - Optional - Support email displayed to end users - **connect_require_key_auth_test** (boolean) - Optional - Send a test request to the upstream API when adding Connect accounts for key-based apps ### Request Example ```python client.projects.create( name="My New Project", app_name="My App", support_email="support@example.com", connect_require_key_auth_test=True, ) ``` ### Response #### Success Response (201) - **Project** - The newly created project object. #### Response Example ```json { "id": "proj_...", "name": "My New Project", "app_name": "My App", "created_at": "2023-01-01T12:00:00.000Z" } ``` ``` -------------------------------- ### Get Project Info Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/projects.md Retrieves detailed information about the current project, including its ID, workspace ID, and available apps. ```APIDOC ## ProjectsClient.info() ### Description Retrieves detailed information about the current project, including its ID, workspace ID, and available apps. ### Method `info` ### Parameters #### Path Parameters None #### Query Parameters - **request_options** (RequestOptions) - Optional - Request configuration ### Returns `ProjectInfoResponse` — Detailed project information including available apps. ### Example ```python from pipedream import Pipedream client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) info = client.projects.info() print(f"Project: {info.project_id}") print(f"Workspace: {info.workspace_id}") print(f"Available apps: {len(info.available_apps)}") ``` ``` -------------------------------- ### Initialize Pipedream Client with Client Credentials Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/pipedream-client.md Use this snippet to initialize the Pipedream client using client ID and secret for authentication. It shows how to access and list applications. ```python from pipedream import Pipedream client = Pipedream( client_id="your_client_id", client_secret="your_client_secret", project_id="your_project_id", ) # Access a resource apps = client.apps.list(limit=10) for app in apps: print(app.name) ``` -------------------------------- ### Iterating All Items with SyncPager Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/README.md Iterate through all items returned by a paginated resource using SyncPager. This example prints the name of each app. ```python # Iterate all items pager = client.apps.list(limit=10) for app in pager: print(app.name) ``` -------------------------------- ### Migrate ConfigurableProp_* Aliases Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/MIGRATE.md In v2.x, the `ConfigurableProp_*` aliases have been removed. Use the un-prefixed variants instead. For example, `ConfigurableProp_String` is now `ConfigurablePropString`. ```python # v1.x (old) from pipedream import ( ConfigurableProp_Alert, ConfigurableProp_Integer, ConfigurableProp_String, ) # v2.x (new) from pipedream import ( ConfigurablePropAlert, ConfigurablePropInteger, ConfigurablePropString, ) ``` -------------------------------- ### Retrieve Project Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Retrieves details for a specific project using its project ID. The project ID must start with `proj_`. ```python from pipedream import Pipedream from pipedream.environment import PipedreamEnvironment client = Pipedream( client_id="", client_secret="", environment=PipedreamEnvironment.PROD, ) client.projects.retrieve( project_id="project_id", ) ``` -------------------------------- ### Retrieve a Specific Connected Account Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Get the details for a single connected account using its ID. Optionally include credentials in the response. ```python from pipedream import Pipedream from pipedream.environment import PipedreamEnvironment client = Pipedream( client_id="", client_secret="", environment=PipedreamEnvironment.PROD, ) client.accounts.retrieve( account_id="account_id", include_credentials=True, ) ``` -------------------------------- ### Configure Pipedream Client with Custom httpx Client and Proxy Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/configuration.md Initialize the Pipedream client with a pre-configured `httpx.Client` instance that includes proxy settings. This allows all SDK requests to go through the specified proxy. ```python import httpx from pipedream import Pipedream httpx_client = httpx.Client( proxy="http://proxy.example.com:8080", ) client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", httpx_client=httpx_client, ) ``` -------------------------------- ### client.apps.retrieve Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Get detailed information about a specific app by ID or name slug. This method is useful for fetching details of a single application. ```APIDOC ## client.apps.retrieve ### Description Get detailed information about a specific app by ID or name slug. ### Parameters #### Path Parameters - **app_id** (str) - The name slug or ID of the app (e.g., 'slack', 'github') #### Query Parameters - **request_options** (typing.Optional[RequestOptions]) - Request-specific configuration. ``` -------------------------------- ### Create Connect Token (Default Settings) Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/tokens.md Generates a Connect token with default expiration and scope settings. Requires Pipedream client initialization. ```python from pipedream import Pipedream client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # Create token with default settings response = client.tokens.create( external_user_id="customer_123", ) print(f"Token: {response.token}") ``` -------------------------------- ### Create and Validate Token with AsyncTokensClient Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/tokens.md Demonstrates how to create a new Connect token and then validate its authenticity using the asynchronous AsyncTokensClient. Ensure you have initialized the client with your credentials. ```python import asyncio from pipedream import AsyncPipedream async def main(): client = AsyncPipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # Create token response = await client.tokens.create( external_user_id="customer_123", expires_in=3600, allowed_origins=["https://myapp.com"], ) token = response.token print(f"Token: {token}") # Validate token response = await client.tokens.validate( ctok=token, app_id="slack", ) print(f"Valid: {response.valid}") asyncio.run(main()) ``` -------------------------------- ### Build the Project Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/CONTRIBUTING.md Builds the Python project, typically creating distribution packages. ```bash poetry build ``` -------------------------------- ### Use Custom Python Logger Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/configuration.md Integrate your existing Python logging setup by passing a configured logger instance to the Pipedream client. ```python import logging from pipedream import Pipedream # Use Python's built-in logging logger = logging.getLogger("my_app") logger.setLevel(logging.DEBUG) client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", logging=logger, ) ``` -------------------------------- ### Create Basic Project Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/projects.md Creates a new Pipedream project with a required name. Use this for simple project creation. ```python from pipedream import Pipedream client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # Create basic project project = client.projects.create( name="My New Project", ) print(f"Project ID: {project.id}") ``` -------------------------------- ### Retrieve Specific Action Configuration - Python Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Get detailed configuration for a specific action using its component ID and an optional version number. ```python from pipedream import Pipedream from pipedream.environment import PipedreamEnvironment client = Pipedream( client_id="", client_secret="", environment=PipedreamEnvironment.PROD, ) client.actions.retrieve( component_id="component_id", version="1.2.3", ) ``` -------------------------------- ### TriggersClient.retrieve() Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/triggers.md Get detailed configuration for a specific trigger using its component ID. Optionally, you can specify a version to retrieve a particular trigger version. ```APIDOC ## TriggersClient.retrieve() ### Description Get detailed configuration for a specific trigger using its component ID. Optionally, you can specify a version to retrieve a particular trigger version. ### Method `retrieve` ### Parameters #### Path Parameters - **component_id** (str) - Required - Trigger component ID or key #### Query Parameters - **version** (str) - Optional - Semantic version (defaults to latest) - **request_options** (RequestOptions) - Optional - Request configuration ### Request Example ```python client.triggers.retrieve("slack-new-message") ``` ### Response #### Success Response `Component` — Trigger metadata with all configurable props. #### Response Example ```python print(f"Trigger: {trigger.name}") print(f"Props: {[p for p in trigger.configurable_props]}") ``` ### Errors - **NotFoundError** (404) - Trigger not found ``` -------------------------------- ### Create Project Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/api-reference/projects.md Creates a new project for the authenticated workspace. Requires a project name and can optionally include an app name, support email, and key authentication test setting. ```APIDOC ## ProjectsClient.create() ### Description Creates a new project for the authenticated workspace. Requires a project name and can optionally include an app name, support email, and key authentication test setting. ### Method `create` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **name** (str) - Required - Project name - **app_name** (str) - Optional - Display name for the Connect application - **support_email** (str) - Optional - Support email displayed to end users in Connect UI - **connect_require_key_auth_test** (bool) - Optional - Send a test request to the upstream API when adding Connect accounts for key-based apps - **request_options** (RequestOptions) - Optional - Request configuration ### Returns `Project` — Created project object. ### Errors - BadRequestError (400) - Invalid project name - ApiError (401) - Unauthorized ### Example ```python from pipedream import Pipedream client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", ) # Create basic project project = client.projects.create( name="My New Project", ) print(f"Project ID: {project.id}") # Create with full configuration project = client.projects.create( name="Customer Integration Platform", app_name="Integration Hub", support_email="support@example.com", connect_require_key_auth_test=True, ) ``` ``` -------------------------------- ### Format Code Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/CONTRIBUTING.md Formats the code according to project style guidelines using Ruff. ```bash poetry run ruff format . ``` -------------------------------- ### Retrieve Specific App Details Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/reference.md Get detailed information about a specific app by its ID or name slug. Use this to fetch details for a known app. ```python from pipedream import Pipedream from pipedream.environment import PipedreamEnvironment client = Pipedream( client_id="", client_secret="", environment=PipedreamEnvironment.PROD, ) client.apps.retrieve( app_id="app_id", ) ``` -------------------------------- ### Enable Basic Logging Source: https://github.com/pipedreamhq/pipedream-sdk-python/blob/main/_autodocs/configuration.md Enable SDK-level logging for all requests by passing an instance of LogConfig with enabled=True. ```python from pipedream import Pipedream from pipedream.core.logging import LogConfig # Enable logging for all requests client = Pipedream( client_id="client_id", client_secret="client_secret", project_id="project_id", logging=LogConfig( enabled=True, ), ) ```