@AlphaKeloid

Не поднимается бот telegram, причина в блокировках?

Всем привет
На моем пк не поднимается бот , подозреваю что проблема в провайдере
Во всяком случае после гугления я пришел к такому выводу
Накинул прокси, но все равно не работает
прокси использовал socks5 - socks5://132.456.789.012:25565 user pass

Лог
2019-08-07 16:24:02,836 - WARNING - Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<telegram.vendor.ptb_urllib3.urllib3.contrib.socks.SOCKSHTTPSConnection object at 0x03661BB0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /bot<TOKEN>/deleteWebhook
2019-08-07 16:24:02,870 - WARNING - Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<telegram.vendor.ptb_urllib3.urllib3.contrib.socks.SOCKSHTTPSConnection object at 0x038B0C30>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /bot<TOKEN>/deleteWebhook
2019-08-07 16:24:02,904 - WARNING - Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<telegram.vendor.ptb_urllib3.urllib3.contrib.socks.SOCKSHTTPSConnection object at 0x038B0D30>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /bot<TOKEN>/deleteWebhook
2019-08-07 16:24:02,939 - ERROR - Error while bootstrap del webhook: urllib3 HTTPError SOCKSHTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot<TOKEN>/deleteWebhook (Caused by NewConnectionError('<telegram.vendor.ptb_urllib3.urllib3.contrib.socks.SOCKSHTTPSConnection object at 0x038B0E90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
2019-08-07 16:24:02,939 - WARNING - Failed bootstrap phase; try=1 max_retries=-1
2019-08-07 16:24:10,475 - WARNING - Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<telegram.vendor.ptb_urllib3.urllib3.contrib.socks.SOCKSHTTPSConnection object at 0x038B0E30>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /bot<TOKEN>/deleteWebhook
2019-08-07 16:24:10,519 - WARNING - Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<telegram.vendor.ptb_urllib3.urllib3.contrib.socks.SOCKSHTTPSConnection object at 0x03661FB0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /bot<TOKEN>/deleteWebhook
2019-08-07 16:24:10,566 - WARNING - Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<telegram.vendor.ptb_urllib3.urllib3.contrib.socks.SOCKSHTTPSConnection object at 0x038B0EB0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /bot<TOKEN>/deleteWebhook
2019-08-07 16:24:10,601 - ERROR - Error while bootstrap del webhook: urllib3 HTTPError SOCKSHTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot<TOKEN>/deleteWebhook (Caused by NewConnectionError('<telegram.vendor.ptb_urllib3.urllib3.contrib.socks.SOCKSHTTPSConnection object at 0x038B0DF0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
2019-08-07 16:24:10,601 - WARNING - Failed bootstrap phase; try=2 max_retries=-1
2019-08-07 16:24:17,931 - INFO - Received signal 2 (SIGINT), stopping...
">

код
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters

import logging

PROXY = {
    'proxy_url': 'my socks5 proxy url',
    'urllib3_proxy_kwargs': {
        'username': 'proxy user',
         'password': 'proxy pass'
    }
}

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

def greet_user(bot, update):
    text = 'все работает!'
    logging.info(text)
    update.message.reply_text(text)

def talk_to_me(bot, updater):
    user_text = 'Привет {}! Ты написал : {}'.format(update.message.chat.first_name, update.message.text)
    logging.info('User: %s, Chat id: %s, Message: %s',
                update.message.chat.username,
                update.message.chat.id,
                update.message.text)
    update.message.replay_text(user_text)

def main():
    my_bot = Updater('token', request_kwargs=PROXY)
    
    #logging.info('bot is run')

    dp = my_bot.dispatcher
    dp.add_handler(CommandHandler('start', greet_user))
    dp.add_hendler(MessageHandler(Filters.text, talk_to_me))

    my_bot.start_polling()
    my_bot.idle()

main()
  • Вопрос задан
  • 281 просмотр
Пригласить эксперта
Ответы на вопрос 1
@MainDel
Можешь воспользоваться бесплатным VPN для компьютера.
Если захочешь ставить своего бота на хостинг, то скорее всего там будет работать и без VPN и без прокси
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы