Make sense?
And to be complete, I used the “generate test event” in the webhook. I clicked to the parameters section and added my parameter.
Hi Tim, amazing thank you so much I will try this then!
with this code
def handler(pd):
# Extract the URL of the current event
event_url = pd[“steps”][“event”][“url”]
# Parse the event URL to extract the "word" parameter
from urllib.parse import urlparse, parse_qs
parsed_url = urlparse(event_url)
query_params = parse_qs(parsed_url.query)
word_value = query_params.get("word", [None])[0]
# Use the value of "word" in another step
# ...
print(f"The value of 'word' is {word_value}")
I’m getting this ‘Pipedream’ object is not subscriptable
DETAILS
Timestamp
30/03/2023, 17:30:33Duration
7ms
pd.steps do I need this also if the first “step” is the actual trigger?
as an initial step, just do something like print(pd) at the top, no other code, and look at the output
Also note when looking at results, you can “copy path” and “copy value” to aid in not having to type as much. But you may need to transform dots to []. Example of a copied path steps.trigger.event.query.myparameter
Here’s a quick demonstration to use the Copy Path
and action to quickly reference a query param from the trigger:
You don’t need to import any query string parsing library to accomplish referencing individual variables.
def handler(pd: "pipedream"):
# Reference the "word" query param from the triggering HTTP request
return pd.steps["trigger"]["event"]["query"]["word"])
Thank you so much Pierce and Tim I think I managed to do it. Thank you
Great glad to hear it
Yahoo! what did you use to make the quick gif? I do screenshots and videos well, need to have an animated gif solution as that may save some words and typing.
Cleanshot is my tool of choice at the moment. But it lacks in cataloging so quickly search for past GIFs/videos you’ve made. I really wish it had that, but otherwise great tool.