: api_py_function() missing 1 required positional argument: 'features'

Options
rawan_mohammed
rawan_mohammed Registered Posts: 8
edited July 16 in Using Dataiku

I am working on a python function API but every time I try to call from an external source, i get the same error message:

"errorType": "com.dataiku.dip.io.SocketBlockLinkKernelException",
    "message": "Failed to run function : <class 'TypeError'> : api_py_function() missing 1 required positional argument: 'features'",
    "detailedMessage": "Failed to run function : <class 'TypeError'> : api_py_function() missing 1 required positional argument: 'features'",
    "detailedMessageHTML": "<span><span class=\"err-msg\">Failed to run function : &lt;class 'TypeError'&gt; : api_py_function() missing 1 required positional argument: 'features'</span></span>",

The code of the API (im using it to access another api):

def api_py_function(features):
    response = requests.post(env_url, json=features, verify=False)
    return response.json()

The request body i sent:

{
    "features": {
       "Name": "name", 
       "Age": 10 
    }
}

I tried sending the request with both python and post man, but I keep getting the same error.


Operating system used: Windows 11

Answers

Setup Info
    Tags
      Help me…