: api_py_function() missing 1 required positional argument: 'features'
rawan_mohammed
Registered Posts: 8 ✭
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 : <class 'TypeError'> : 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
Tagged:
Answers
-
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
-
Hey @rawan_mohammed
, do you happen to have any updates on this issue?