api.telegram超时阻断解决方法
2023-7-30 18:2:0 Author: blog.upx8.com(查看原文) 阅读量:16 收藏

错误:HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=25)

解决方法:

安装sudo apt install tor

sudo apt install privoxy torsocks

nano /etc/privoxy/config

pip install pysocks 

forward-socks5t / 127.0.0.1:9050 .

sudo systemctl enable privoxy.service
sudo systemctl start privoxy.service

/etc/tor/torsocks.conf

TorAddress 127.0.0.1
TorPort 9050
from telebot import apihelper

apihelper.proxy = {'https': 'socks5h://127.0.0.1:9050',
#    'http':'http://127.0.0.1:8118',
#    'https':'https://127.0.0.1:8118'
}
bot = telebot.TeleBot(TOKEN) # be sure telebot.TeleBot calls after apihelper.proxy

文章来源: https://blog.upx8.com/3727
如有侵权请联系:admin#unsafe.sh