Я пытаюсь вызвать свой собственный Post API
из функции python, нет проблем в API, он работает нормально, но когда я пытаюсь вызвать POST
API from Python function
ниже мой код
@app.route('/dhiru_post', methods=['GET'])
def dhiru_post():
url = "https://www.mydomainamehere.com/api_new/"
payload = {"number": 12524,
"api_type": "news_listing",
"slug": "life-mantra",
"start": 0,
"end": 10}
response_decoded_json = requests.post(url, data=payload)
response_json = response_decoded_json.json()
return response_json
Примечание: https://www.mydomainamehere.com/api_new/ это не точное
URL, пожалуйста, игнорируйте.
Ошибка :
откройте этот URL:
https://dhiru -ai-quantomsoftech.herokuapp.com / webhook_dhiru
TypeError
TypeError: 'dict' object is not callable
Traceback (most recent call last)
File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/app/.heroku/python/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1478, in full_dispatch_request
response = self.make_response(rv)
File "/app/.heroku/python/lib/python3.6/site-packages/flask/app.py", line 1577, in make_response
rv = self.response_class.force_type(rv, request.environ)
File "/app/.heroku/python/lib/python3.6/site-packages/werkzeug/wrappers/base_response.py", line 269, in force_type
response = BaseResponse(*_run_wsgi_app(response, environ))
File "/app/.heroku/python/lib/python3.6/site-packages/werkzeug/test.py", line 1119, in run_wsgi_app
app_rv = app(environ, start_response)
TypeError: 'dict' object is not callable
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object