Vladislav_Voronin________
New member
Вот мой скрипт:
import telebot
token = 'Мой токен'
bot = telebot.TeleBot(token)
#Само подключение к прокси
from telebot import apihelper
apihelper.proxy = {'https':'socks5://138.36.21.75:9913'}
@bot.message_handler(commands=['start','Start'])
def start(message):
bot.send_message(message.chat.id,'Hello')
bot.polling()
При запуске у него возникает ошибка:
python3 proxy-test.py
2020-03-21 19:06:53,509 (util.py:65 PollingThread) ERROR - TeleBot: "AssertionError occurred, args=('Not supported proxy scheme socks5',)
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/telebot/util.py", line 59, in run
task(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/telebot/__init__.py", line 276, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "/usr/local/lib/python3.7/dist-packages/telebot/__init__.py", line 246, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates)
File "/usr/local/lib/python3.7/dist-packages/telebot/apihelper.py", line 180, in get_updates
return _make_request(token, method_url, params=payload)
File "/usr/local/lib/python3.7/dist-packages/telebot/apihelper.py", line 54, in _make_request
timeout=(connect_timeout, read_timeout), proxies=proxy)
File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 337, in send
conn = self.get_connection(request.url, proxies)
File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 245, in get_connection
proxy_manager = self.proxy_manager_for(proxy)
File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 155, in proxy_manager_for
**proxy_kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/poolmanager.py", line 280, in proxy_from_url
return ProxyManager(proxy_url=url, **kw)
File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/poolmanager.py", line 231, in __init__
'Not supported proxy scheme %s' % proxy.scheme
AssertionError: Not supported proxy scheme socks5
"
Traceback (most recent call last):
File "proxy-test.py", line 39, in <module>
bot.polling()
File "/usr/local/lib/python3.7/dist-packages/telebot/__init__.py", line 389, in polling
self.__threaded_polling(none_stop, interval, timeout)
File "/usr/local/lib/python3.7/dist-packages/telebot/__init__.py", line 412, in __threaded_polling
polling_thread.raise_exceptions()
File "/usr/local/lib/python3.7/dist-packages/telebot/util.py", line 78, in raise_exceptions
six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
File "/usr/lib/python3/dist-packages/six.py", line 703, in reraise
raise value
File "/usr/local/lib/python3.7/dist-packages/telebot/util.py", line 59, in run
task(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/telebot/__init__.py", line 276, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "/usr/local/lib/python3.7/dist-packages/telebot/__init__.py", line 246, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates)
File "/usr/local/lib/python3.7/dist-packages/telebot/apihelper.py", line 180, in get_updates
return _make_request(token, method_url, params=payload)
File "/usr/local/lib/python3.7/dist-packages/telebot/apihelper.py", line 54, in _make_request
timeout=(connect_timeout, read_timeout), proxies=proxy)
File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 337, in send
conn = self.get_connection(request.url, proxies)
File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 245, in get_connection
proxy_manager = self.proxy_manager_for(proxy)
File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 155, in proxy_manager_for
**proxy_kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/poolmanager.py", line 280, in proxy_from_url
return ProxyManager(proxy_url=url, **kw)
File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/poolmanager.py", line 231, in __init__
'Not supported proxy scheme %s' % proxy.scheme
AssertionError: Not supported proxy scheme socks5
Что делать? Помогите!!!
import telebot
token = 'Мой токен'
bot = telebot.TeleBot(token)
#Само подключение к прокси
from telebot import apihelper
apihelper.proxy = {'https':'socks5://138.36.21.75:9913'}
@bot.message_handler(commands=['start','Start'])
def start(message):
bot.send_message(message.chat.id,'Hello')
bot.polling()
При запуске у него возникает ошибка:
python3 proxy-test.py
2020-03-21 19:06:53,509 (util.py:65 PollingThread) ERROR - TeleBot: "AssertionError occurred, args=('Not supported proxy scheme socks5',)
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/telebot/util.py", line 59, in run
task(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/telebot/__init__.py", line 276, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "/usr/local/lib/python3.7/dist-packages/telebot/__init__.py", line 246, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates)
File "/usr/local/lib/python3.7/dist-packages/telebot/apihelper.py", line 180, in get_updates
return _make_request(token, method_url, params=payload)
File "/usr/local/lib/python3.7/dist-packages/telebot/apihelper.py", line 54, in _make_request
timeout=(connect_timeout, read_timeout), proxies=proxy)
File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 337, in send
conn = self.get_connection(request.url, proxies)
File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 245, in get_connection
proxy_manager = self.proxy_manager_for(proxy)
File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 155, in proxy_manager_for
**proxy_kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/poolmanager.py", line 280, in proxy_from_url
return ProxyManager(proxy_url=url, **kw)
File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/poolmanager.py", line 231, in __init__
'Not supported proxy scheme %s' % proxy.scheme
AssertionError: Not supported proxy scheme socks5
"
Traceback (most recent call last):
File "proxy-test.py", line 39, in <module>
bot.polling()
File "/usr/local/lib/python3.7/dist-packages/telebot/__init__.py", line 389, in polling
self.__threaded_polling(none_stop, interval, timeout)
File "/usr/local/lib/python3.7/dist-packages/telebot/__init__.py", line 412, in __threaded_polling
polling_thread.raise_exceptions()
File "/usr/local/lib/python3.7/dist-packages/telebot/util.py", line 78, in raise_exceptions
six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
File "/usr/lib/python3/dist-packages/six.py", line 703, in reraise
raise value
File "/usr/local/lib/python3.7/dist-packages/telebot/util.py", line 59, in run
task(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/telebot/__init__.py", line 276, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "/usr/local/lib/python3.7/dist-packages/telebot/__init__.py", line 246, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates)
File "/usr/local/lib/python3.7/dist-packages/telebot/apihelper.py", line 180, in get_updates
return _make_request(token, method_url, params=payload)
File "/usr/local/lib/python3.7/dist-packages/telebot/apihelper.py", line 54, in _make_request
timeout=(connect_timeout, read_timeout), proxies=proxy)
File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 337, in send
conn = self.get_connection(request.url, proxies)
File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 245, in get_connection
proxy_manager = self.proxy_manager_for(proxy)
File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 155, in proxy_manager_for
**proxy_kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/poolmanager.py", line 280, in proxy_from_url
return ProxyManager(proxy_url=url, **kw)
File "/usr/local/lib/python3.7/dist-packages/requests/packages/urllib3/poolmanager.py", line 231, in __init__
'Not supported proxy scheme %s' % proxy.scheme
AssertionError: Not supported proxy scheme socks5
Что делать? Помогите!!!