Restapi task

I am trying to run python task but getting an error , same script is running manally from MD cli


Are you defining your Additional packages on the task?

Ahh , got it , its working now , how to pass print command here , i want to run print(requests) but i see empty screen

i use GET to fetch some information , or POST to create , both task needs to return some output which i need to pass in other task input , how is it possible ?

You can use a workflow and task results to do that. This link has some additional context for that: Task Results — Morpheus Docs documentation.

Just make sure you are only outputting what you want to be read in the next task and it is in the proper format (ie. JSON)

Just to add onto the original question, python tasks run in a fresh virtual environment, so you need to put any additional packages into the tasks options to make sure they are installed when you run the task.

I have already selected json as result type but i see no information , where can i check the Result is published or not ?

Hi @Paul_B,

Here is an example I created similar to your code:

import requests
api_url = ""
response = requests.get(api_url)

This is the resulting data output:

Here is the configuration of the task I made:

You should see the results in the output in Morpheus, otherwise, the data will most likely not be available to the results variable.

Hope that helps!