Пример #1
0
                            a['date'], "%Y-%m-%d %H:%M:%S").date()
                        bot_response += (
                            "{}-{}-{}, {} with a temperature of {} celcius and humidity of {}%\n"
                            .format(d.day, d.month, d.year, a['desc'],
                                    a['temp'], a['humidity']))

                else:
                    bot_response += "Sorry, couldn't get the forecast"

                bot_speech = bot_response[l:]

            elif inp == '9' or inp == '10':
                news = kernel.getPredicate('news')
                if news != "":
                    if inp == '9':
                        n = News.get_india_top_headlines(news)
                    else:
                        n = News.get_world_top_headlines(news)
                else:
                    if inp == '9':
                        n = News.get_india_top_headlines()
                    else:
                        n = News.get_world_top_headlines()
                if n['success']:
                    bot_speech = ""
                    for a in n['a']:
                        bot_response += "{}\n{}\n".format(a['title'], a['url'])
                        bot_speech += "{}\n".format(a['title'])

                else:
                    bot_response += "Sorry, couldn't get the news"