Answer the question
In order to leave comments, you need to log in
How to use Proxy in TelegramBot?
There was a problem with starting the bot using Proxy:
I found 2 options for using Proxy in PyTelegramBotApi on the Internet:
1) http proxy
from telebot import apihelper
apihelper.proxy = {'http':'http://10.10.1.10:3128'}
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot601452123:AAFiRXuFyHcoNdOsOI2ty9NXCPgx-3n14Uo/getUpdates?offset=1&timeout=123 (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),))
[Finished in 2.4s]
apihelper.proxy = {'https':'socks5://userproxy:[email protected]_address:port'}
requests.exceptions.ConnectTimeout: SOCKSHTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot601452123:AAFiRXuFyHcoNdOsOI2ty9NXCPgx-3n14Uo/getUpdates?offset=1&timeout=20 (Caused by ConnectTimeoutError(<urllib3.contrib.socks.SOCKSHTTPSConnection object at 0x0000000004B28A20>, 'Connection to api.telegram.org timed out. (connect timeout=3.5)'))
[Finished in 6.9s]
ip = 'ip' # change your proxy's ip
port = port # change your proxy's port
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, ip, port)
socket.socket = socks.socksocket
sqlalchemy.exc.InterfaceError: (mysql.connector.errors.InterfaceError) 2003: Can't connect to MySQL server on 'localhost:3306' (Socket error: 0x03: Network unreachable) (Background on this error at: http://sqlalche.me/e/rvf5)
Answer the question
In order to leave comments, you need to log in
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot601452123:AAFiRXuFyHcoNdOsOI2ty9NXCPgx-3n14Uo/getUpdates?offset=1&timeout=123 (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),))
[Finished in 2.4s]
from telebot import apihelper
apihelper.proxy = {'https':'https://88.204.154.155:8080''}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question