Answer the question
In order to leave comments, you need to log in
How to bypass telegram blocking?
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: SOCKSHTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot577218600:AAGQNIaPkdTpWQJUN8DhLmlIb8-0UvMaiXM/getUpdates?offset=1&timeout =20 (Caused by ConnectTimeoutError(, 'Connection to api.telegram.org timed out. (connect timeout=3.5)'))
I started writing a telegram bot and I can't do a check when running it on my computer. In the future, I will transfer the bot to a non-Russian server and there will be no problems. Now I need to check what I write
Answer the question
In order to leave comments, you need to log in
#Like this, in the code:
from telebot import apihelper
apihelper.proxy = {'https': 'socks5://xxx.xxx.xxx.xxx:yyyy'}
#xxx - ip, yyyy - port
Before that, you need to set requests[ socks], I have on ubuntu 16.04:
sudo pip3.6 install -U requests[socks]
But this breaks the work of CAPS (printers on ubuntu 16.04), but the proxy worked. On windows should not break anything.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question