def handle_http(self, status_code, path): self.send_response(status_code) self.send_header('Content-type', 'text/html') self.end_headers() print('Request passed in browser: ', path) file_to_process = path.split('/')[1] print('fkjnwpjngwortngpwrtngpowrtnhwoirht', path.split('/')[1]) if path in PATHS.keys(): request_data = middleware.get_data(file_to_process) chart_data = request_data['chart_data'] # status_nasos_nagrev = request_data['status_nasos_nagrev'] status_nasos_nagrev = middleware.get_updated_relay_state() final_content = html_data.format( chart_data=chart_data, status_nasos_nagrev=status_nasos_nagrev, # history_data = middleware.get_available_data(), grafic_date=middleware.get_data_date(file_to_process), data_headers=request_data['data_headers']) return bytes(final_content, 'UTF-8') if path in API_PATHS: final_content = middleware.process_api_request(path) return bytes(final_content, 'UTF-8') else: final_content = '<h3>404 page not found</h3>' return bytes(final_content, 'UTF-8')
def run(self, dispatcher, tracker, domain): message = 'All ChatBots that i know can talk about ' try: result = get_data('a chatbot:Conversation') message += format_result(result) except ValueError: message = API_CONNECTION_ERROR dispatcher.utter_message(message)
def run(self, dispatcher, tracker, domain): message = 'Who knows talk about it is ' try: result = get_data('chatbot:participate chatbot:knowUnbRuMenu') result = format_result(result) message += result except ValueError: message = API_CONNECTION_ERROR dispatcher.utter_message(message)
def run(self, dispatcher, tracker, domain): message = 'I know ' try: result = get_data('a chatbot:ChatBot') message += format_result(result) except ValueError: message = API_CONNECTION_ERROR dispatcher.utter_message(message)
def run(self, dispatcher, tracker, domain): tslot = tracker.get_slot('class').lower() if tslot not in domain['slots']['class']['values']: dispatcher.utter_message("Sorry, i don't know this concept yet =/") elif tslot != None: try: dispatcher.utter_message("You are asking about: ") dispatcher.utter_message(tslot) dispatcher.utter_message( format_result(get_data(query=classQuery), 'class', tslot)) except ValueError: dispatcher.utter_message(API_CONNECTION_ERROR) else: dispatcher.utter_message( "You need to tell what you want to know ;)")