I am trying to develop a chatbot using Django and depending on the user's input, various python scripts need to be run.
Having the project structure (presented below), is there a way to call the news.py in chatbot.js?
I have tried with an ajax request:
$.ajax({
type: "POST",
url: "news/",
data: { }
}).done(function( o ) {
print('success')
});
and defined news/ in my urls.py
url('news/', getNews)
where getNews is defined in my views
from artemis.static.marketdata.news import scrape
class getNews():
scrape()
but I get a 500 error saying that TypeError: object() takes no parameters
Traceback:
Internal Server Error: /news/
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\exception.py", line 41, in inner
response = get_response(request)
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\handlers\base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
TypeError: object() takes no parameters
What would be the preferable approach in this case? Any tip would be greatly appreciated!
