<commit_before>import telegram
import tornado.ioloop
import tornado.web
from tornado.options import define, options

from goodreads_api import get_book_details_by_name, BookNotFound
from utils import get_formatted_book_data
from settings import TELEGRAM_ACCESS_TOKEN, WEBHOOK_URL

define("port", default=5000, help="run on the given port", type=int)

bot = telegram.Bot(token=TELEGRAM_ACCESS_TOKEN)


class IndexHandler(tornado.web.RequestHandler):
    def get(self):
        self.write('wink, wink')


class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write('wink, wink')

    def post(self):
        data = tornado.escape.json_decode(self.request.body)
        print("Received request: {}".format(data))
        try:
            message_id = data['message']['message_id']
            chat_id = data['message']['chat']['id']
            text = data['message']['text']
            print("Received message_id: {}, chat_id: {}, text: {}".format(
                message_id, chat_id, text))
            response = parse_command(text=text)
            if response:
                bot.sendMessage(reply_to_message_id=message_id,
                                chat_id=chat_id, text=response,
                                disable_web_page_preview=True,
                                parse_mode='Markdown')
        except KeyError:
            pass
        except telegram.error.TelegramError as e:
            print(data)
            print(e)
        return


class WebHookHandler(tornado.web.RequestHandler):
    def get(self):
        # one time only operation
        response = bot.setWebhook(WEBHOOK_URL)
        if not response:
            return self.write('Setting up webhook has failed')
        return self.write('Webhook has been successfully set')
<commit_msg>Remove print statement<commit_after>import telegram
import tornado.ioloop
import tornado.web
from tornado.options import define, options

from goodreads_api import get_book_details_by_name, BookNotFound
from utils import get_formatted_book_data
from settings import TELEGRAM_ACCESS_TOKEN, WEBHOOK_URL

define("port", default=5000, help="run on the given port", type=int)

bot = telegram.Bot(token=TELEGRAM_ACCESS_TOKEN)


class IndexHandler(tornado.web.RequestHandler):
    def get(self):
        self.write('wink, wink')


class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write('wink, wink')

    def post(self):
        data = tornado.escape.json_decode(self.request.body)
        try:
            message_id = data['message']['message_id']
            chat_id = data['message']['chat']['id']
            text = data['message']['text']
            print("Received message_id: {}, chat_id: {}, text: {}".format(
                message_id, chat_id, text))
            response = parse_command(text=text)
            if response:
                bot.sendMessage(reply_to_message_id=message_id,
                                chat_id=chat_id, text=response,
                                disable_web_page_preview=True,
                                parse_mode='Markdown')
        except KeyError:
            pass
        except telegram.error.TelegramError as e:
            print(data)
            print(e)
        return


class WebHookHandler(tornado.web.RequestHandler):
    def get(self):
        # one time only operation
        response = bot.setWebhook(WEBHOOK_URL)
        if not response:
            return self.write('Setting up webhook has failed')
        return self.write('Webhook has been successfully set')

{'fraction_non_alphanumeric': 0.09652076318742986, 'fraction_numerical': 0.002244668911335578, 'mean_word_length': 2.478048780487805, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3148312', 'n_tokens_mistral': 1024, 'n_tokens_neox': 981, 'n_words': 225}