<class 'TypeError'> : api_py_function() missing 1 required positional argument: 'features'

rawan_mohammed
Level 2
<class 'TypeError'> : api_py_function() missing 1 required positional argument: 'features'

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

0 Kudos
2 Replies
nmadhu20

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

0 Kudos
kirilov
Level 2

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

0 Kudos

Labels

?
Labels (2)
A banner prompting to get Dataiku