Anything you can do in Python can be done in a Pipedream Workflow. This includes using any of the 350,000+ PyPi packages available in your Python powered workflows.
Go to siteDevelop, run and deploy your Python code in Pipedream workflows. Integrate seamlessly between no-code steps, with connected accounts, or integrate Data Stores and manipulate files within a workflow.
This includes installing PyPI packages, within your code without having to manage a requirements.txt
file or running pip
.
Below is an example of using Python to access data from the trigger of the workflow, and sharing it with subsequent workflow steps:
def handler(pd: "pipedream"):
# Reference data from previous steps
print(pd.steps["trigger"]["context"]["id"])
# Return data for use in future steps
return {"foo": {"test":True}}
Here are three practical uses for incorporating Python code in Pipedream workflows:
These applications of Python in Pipedream workflows enable sophisticated data operations, extend functionality with external APIs, and incorporate advanced analytics and machine learning directly into your automated processes.
To add a Python code step, open a new workflow and include a step.
Now you’re ready to write some code!
On the right, you'll see the default code provided by Pipedream:
def handler(pd: "pipedream"):
# Reference data from previous steps
print(pd.steps["trigger"]["context"]["id"])
# Return data for use in future steps
return {"foo": {"test": True}}
You can write your custom code within the handler
function. handler
is called when this step executes in your workflow. The pd
argument contains the workflow's context and data.
When you click Test on the Python code step, it will display the event data from your trigger step. For instance, if your trigger is an HTTP request, then the HTTP request data will be returned.
This step can execute any Python code. However, the handler
function, a special Pipedream callback, must be set up correctly to return data. Otherwise, you can run arbitrary code that:
Write Python and use any of the 350k+ PyPi packages available. Refer to the Pipedream Python docs to learn more.
Pipedream will show your error traces within your individual steps, under the Logs section.
Traces across all of your workflows are also available within the Event History in your Pipedream workspace. This gives a global view of all failed executions, and gives you the tools to filter by workflow, time occurred and more.