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

rawan_mohammed
rawan_mohammed Registered Posts: 8
edited July 2024 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

  • nmadhu20
    nmadhu20 Neuron, Registered, Neuron 2022, Neuron 2023 Posts: 35 Neuron

    Hey @rawan_mohammed

    I tried re-creating your error with the same request JSON but was unable to do so.

    Are you getting the same/different/no error when you test your endpoint using 'Run Test Queries' before deploying?

    Regards,

    Madhuleena

  • kirilov
    kirilov Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Registered Posts: 4

    Hey @rawan_mohammed
    , do you happen to have any updates on this issue?

Setup Info
    Tags
      Help me…