M
M
makcTG2020-06-11 13:53:27
Python
makcTG, 2020-06-11 13:53:27

How to use proxy in python for telegram bot?

Before writing logic to the bot, I decided to try to run it without logic, it gives an error

raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.telegram.org', port=443):
 Max retries exceeded with url: /bot1199951572:AAFT5CT8mEvmgQ5-Fqwbs6RdqbTJfFrxpIM/getUpdates?
offset=1&timeout=20 
(Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection
 object at 0x03F59BC8>: Failed to establish a new connection:
 [WinError 10061] Подключение не установлено, т.к. конечный компьютер отверг запрос на подключение'))

I suppose this is due to the blocking of telegrams in Russia, but I don’t want to run the program with vpn, how can I use a proxy here?
import telebot

token = "some token"
bot = telebot.TeleBot(token)

bot.polling()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2020-06-11
@makcTG

Hmm, maybe worth reading off. documentation?
proxy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question