I am developing my bot to play Telegram Pathfinder
I have a home server (a free laptop) to install it. For this work you need to use a proxy bot (for blocking). I do not want to install VPN on the server, and use the built-in library of pyTelegramBotApi
the ability to use a proxy. If you are using VPN it works.
The code snippet:
PROXY = 'socks5: //148.72.209.6: 57,437'
apihelper.proxy = { 'https': PROXY}
bot = telebot.TeleBot (TOKEN)
If I try to run a proxy displays the following message:
(util.py:65 PollingThread) ERROR - TeleBot: "InvalidSchema occurred, args = ( 'Missing dependencies for SOCKS support. ',)
Traceback (MOST Recent Call Last):
File "C: \ Coding \ BotsTelegram \ SecondBot \ env \ lib \ site-packages \ telebot \ util.py", line 59, in run
task (* args, ** kwargs)
File "C: \ Coding \ BotsTelegram \ SecondBot \ env \ lib \ site-packages \ telebot \ __ init__.py", line 276, in __retrieve_updates
updates = self.get_updates (offset = (self.last_update_id + 1), timeout = timeout)
File "C: \ Coding \ BotsTelegram \ SecondBot \ env \ lib \ site-packages \ telebot \ __ init__.py", line 246, in get_updates
json_updates = apihelper.get_updates (self.token, offset, limit, timeout, allowed_updates)
File "C: \ Coding \ BotsTelegram \ SecondBot \ env \ lib \ site-packages \ telebot \ apihelper.py", line 180, in get_updates
return _make_request (token, method_url, params = payload)
File "C: \ Coding \ BotsTelegram \ SecondBot \ env \ lib \ site-packages \ telebot \ apihelper.py", line 54, in _make_request
timeout = (connect_timeout, read_timeout), proxies = proxy)
File "C: \ Coding \ BotsTelegram \ SecondBot \ env \ lib \ site-packages \ requests \ sessions.py", line 533, in request
resp = self.send (prep, ** send_kwargs)
File "C: \ Coding \ BotsTelegram \ SecondBot \ env \ lib \ site-packages \ requests \ sessions.py", line 646, in send
r = adapter.send (request, ** kwargs)
File "C: \ Coding \ BotsTelegram \ SecondBot \ env \ lib \ site-packages \ requests \ adapters.py", line 412, in send
conn = self.get_connection (request.url, proxies)
File "C: \ Coding \ BotsTelegram \ SecondBot \ env \ lib \ site-packages \ requests \ adapters.py", line 309, in get_connection
proxy_manager = self.proxy_manager_for (proxy)
File "C: \ Coding \ BotsTelegram \ SecondBot \ env \ lib \ site-packages \ requests \ adapters.py", line 189, in proxy_manager_for
** proxy_kwargs
File "C: \ Coding \ BotsTelegram \ SecondBot \ env \ lib \ site-packages \ requests \ adapters.py", line 47, in SOCKSProxyManager
raise InvalidSchema ( "Missing dependencies for SOCKS support.")
requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support.
"
Traceback (MOST Recent Call Last):
File "c: \ Users \ Yang \ .vscode \ extensions \ ms-python.python-2019.8.30787 \ pythonFiles \ ptvsd_launcher.py", line 43, in & lt; module & gt;
main (ptvsdArgs)
File "c: \ Users \ Yang \ .vscode \ extensions \ ms-python.python-2019.8.30787 \ pythonFiles \ lib \ python \ ptvsd \ __ main__.py", line 432, in main
run ()
File "c: \ Users \ Yang \ .vscode \ extensions \ ms-python.python-2019.8.30787 \ pythonFiles \ lib \ python \ ptvsd \ __ main__.py", line 316, in run_file
runpy.run_path (target, run_name = '__ main__')
File "C: \ Users \ Yang \ AppData \ Local \ Programs \ Python \ Python37 \ lib \ runpy.py", line 263, in run_path
pkg_name = pkg_name, script_name = fname)
File "C: \ Users \ Yang \ AppData \ Local \ Programs \ Python \ Python37 \ lib \ runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C: \ Users \ Yang \ AppData \ Local \ Programs \ Python \ Python37 \ lib \ runpy.py", line 85, in _run_code
exec (code, run_globals)
File "c: \ Coding \ BotsTelegram \ SecondBot \ main.py", line 50, in & lt; module & gt;
bot.polling ()
File "C: \ Coding \ BotsTelegram \ SecondBot \ env \ lib \ site-packages \ telebot \ __ init__.py", line 389, in polling
self .__ threaded_polling (none_stop, interval, timeout)
File "C: \ Coding \ BotsTelegram \ SecondBot \ env \ lib \ site-packages \ telebot \ __ init__.py", line 412, in __threaded_polling
polling_thread.raise_exceptions ()
File "C: \ Coding \ Bottelegram \ SecondBot \ ENV \ LIB \ Site-Packages \ Telbot \ Util.py", Line 78, in Raise_Exceptions
Six.Reraise (Self.exc_info [0], self.exc_info [1], self.exc_info [2])
File "C: \ Coding \ Bottelegram \ SecondBot \ ENV \ LIB \ Site-Packages \ Six.py", Line 693, in Reraise
Raise Value.
File "C: \ Coding \ Bottelegram \ SecondBot \ ENV \ LIB \ Site-Packages \ Telbot \ Util.py", Line 59, in Run
Task (* Args, ** kwargs)
File "C: \ Coding \ Bottelegram \ SecondBot \ ENV \ LIB \ Site-Packages \ Telebot \ __ init__.py", line 276, in __retrieve_updates
Updates = Self.get_updates (offset = (self.last_update_id + 1), timeout = timeout)
File "C: \ Coding \ Bottelegram \ SecondBot \ ENV \ LIB \ Site-Packages \ Telebot \ __ init__.py", Line 246, in Get_updates
json_updates = apihelper.get_updates (self.token, offset, limit, timeout, allowed_updates)
File "C: \ Coding \ Bottelegram \ SecondBot \ ENV \ LIB \ Site-Packages \ Telbot \ apihelper.py", Line 180, in Get_updates
Return _make_Request (Token, Method_URL, PARAMS = PAYLOAD)
File "C: \ Coding \ Bottelegram \ SecondBot \ ENV \ LIB \ Site-Packages \ Telbot \ apihelper.py", Line 54, in _make_request
Timeout = (connect_timeout, read_timeout), proxies = proxy)
File "C: \ Coding \ Bottelegram \ SecondBot \ ENV \ Lib \ Site-Packages \ Requests \ Sessions.py", Line 533, in Request
Resp = Self.send (Prep, ** Send_kwargs)
File "C: \ Coding \ Bottelegram \ SecondBot \ ENV \ LIB \ Site-Packages \ Requests \ Sessions.py", Line 646, In Send
R = Adapter.send (Request, ** kwargs)
File "C: \ Coding \ Bottelegram \ SecondBot \ ENV \ LIB \ Site-Packages \ Requests \ Adapters.py", Line 412, In Send
Conn = Self.Get_Connection (Request.url, Proxies)
File "C: \ Coding \ Bottelegram \ SecondBot \ ENV \ LIB \ Site-Packages \ Requests \ Adapters.py", Line 309, in Get_Connection
proxy_manager = Self.Proxy_Manager_For (Proxy)
File "C: \ Coding \ Bottelegram \ SecondBot \ ENV \ Lib \ Site-Packages \ Requests \ Adapters.py", Line 189, In Proxy_Manager_For
** proxy_kwargs.
File "C: \ Coding \ Bottelegram \ SecondBot \ ENV \ LIB \ Site-Packages \ Requests \ Adapters.py", Line 47, in SocksProxyManager
Raise Invalidschema ("Missing Dependencies for Socks Support.")
Requests.Exceptions.Invalidschema: Missing Dependencies for Socks Support.
Answer 1, Authority 100%
You have no PYSOCKS
you need to work with the SOCKS5
protocol.
Install it by entering into the console (or terminal):
Pip Install Pysocks