Проблемы с google docs api и telegram api

Делаю бота, который будет выдавать некую информацию из таблички. Использую google docs api. Когда запускаю код работы с таблицей в отдельном файле, то все работает хорошо, без проблем. Код:

from pprint import pprint
import httplib2
import apiclient.discovery
from oauth2client.service_account import ServiceAccountCredentials

import config

def get_info():

    CREDENTIALS_FILE = config.CREDENTIALS_FILE
    spreadsheet_id = config.spreadsheet_id
    credentials = ServiceAccountCredentials.from_json_keyfile_name(
        CREDENTIALS_FILE,
        ['https://www.googleapis.com/auth/spreadsheets',
         'https://www.googleapis.com/auth/drive'])
    httpAuth = credentials.authorize(httplib2.Http())
    service = apiclient.discovery.build('sheets', 'v4', http=httpAuth)

    values = service.spreadsheets().values().get(
        spreadsheetId=spreadsheet_id,
        range='A1:E10',
        majorDimension='COLUMNS'
    ).execute()
    print(*values["values"])
get_info()

Однако, когда добавляю все это дело в бота, то появляется много странных ошибок, несмотря на которые бот отвечает, и не падает. Кто встречался с данной проблемой, как это можно решить? Заранее спасибо. Код бота и скрин ошибки ниже скриншот ошибки

код бота:

from pprint import pprint
import httplib2
import apiclient.discovery
from oauth2client.service_account import ServiceAccountCredentials
import config
import logging

import telegram
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext

logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
                level=logging.INFO)

logger = logging.getLogger(__name__)
message_num = 0


def start(update: telegram.Update, context):
    """Send a message when the command /start is issued."""
    update.message.reply_text('Hi! Используйте команду /help, чтобы узнать мои команды.')


def help(update, context):
    """Send a message when the command /help is issued."""
    update.message.reply_text(
        'надеюсь это сработает.')


def error(update, context):
    """Log Errors caused by Updates."""
    logger.warning('Update "%s" caused error "%s"', update, context.error)


def autorize():
    credentials = ServiceAccountCredentials.from_json_keyfile_name(
        config.CREDENTIALS_FILE,
        ['https://www.googleapis.com/auth/spreadsheets',
        'https://www.googleapis.com/auth/drive'])
    httpAuth = credentials.authorize(httplib2.Http())
    return httpAuth


def getinfo():
# Авторизуемся и получаем service — экземпляр доступа к API
    credentials = ServiceAccountCredentials.from_json_keyfile_name(
        config.CREDENTIALS_FILE,
        ['https://www.googleapis.com/auth/spreadsheets',
        'https://www.googleapis.com/auth/drive'])
    httpAuth = credentials.authorize(httplib2.Http())
    service = apiclient.discovery.build('sheets', 'v4', http=httpAuth)
    values = service.spreadsheets().values().get(
        spreadsheetId=config.spreadsheet_id,
        range='A1:E10',
        majorDimension='COLUMNS'
    ).execute()
    print(*values["values"])
    return values["values"]


def table(update, context):
    msg: telegram.Message = update.message
    data = getinfo()
    msg.reply_text(data[0])


def main():
    updater = Updater(config.TOKEN, use_context=True)

    dp = updater.dispatcher

    dp.add_handler(CommandHandler("help", help))
    dp.add_handler(CommandHandler("getTable", table))
    dp.add_handler(MessageHandler(Filters.text, start))

# log all errors
    dp.add_error_handler(error)
'''
if config.HEROKU_APP_NAME is None:
    # Start the Bot


    # Run the bot until you press Ctrl-C or the process receives SIGINT,
    #  SIGTERM or SIGABRT. This should be used most of the time, since
    # start_polling() is non-blocking and will stop the bot gracefully.
else:
    updater.start_webhook(listen="0.0.0.0",
                          port=config.PORT,
                          url_path=config.TOKEN)
    updater.bot.set_webhook(f"https://{config.HEROKU_APP_NAME}.herokuapp.com/{config.TOKEN}")
    '''
    updater.start_polling()
    updater.idle()


if __name__ == '__main__':
    main()

Ответы (0 шт):