Answer the question
In order to leave comments, you need to log in
How to fix 'set' object has no attribute 'get' error in telegram bot?
Hello, I am writing a Python telegram bot using the telebot library
import telebot
from telebot import apihelper
bot = telebot.TeleBot("Мой_токен")
apihelper.proxy = {"https':'https://88.204.154.155:8080"}
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
bot.reply_to(message, "Howdy, how are you doing?")
@bot.message_handler(func=lambda message: True)
def echo_all(message):
bot.reply_to(message, message.text)
bot.polling()
2019-08-04 11:58:01,333 (util.py:65 PollingThread) ERROR - TeleBot: "AttributeError occurred, args=("'set' object has no attribute 'get'",)
Traceback (most recent call last):
File "C:\python\dsi\venv\lib\site-packages\telebot\util.py", line 59, in run
task(*args, **kwargs)
File "C:\python\dsi\venv\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:\python\dsi\venv\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:\python\dsi\venv\lib\site-packages\telebot\apihelper.py", line 180, in get_updates
return _make_request(token, method_url, params=payload)
File "C:\python\dsi\venv\lib\site-packages\telebot\apihelper.py", line 54, in _make_request
timeout=(connect_timeout, read_timeout), proxies=proxy)
File "C:\python\dsi\venv\lib\site-packages\requests\sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "C:\python\dsi\venv\lib\site-packages\requests\sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "C:\python\dsi\venv\lib\site-packages\requests\adapters.py", line 337, in send
conn = self.get_connection(request.url, proxies)
File "C:\python\dsi\venv\lib\site-packages\requests\adapters.py", line 241, in get_connection
proxy = proxies.get(urlparse(url.lower()).scheme)
AttributeError: 'set' object has no attribute 'get'
"
Traceback (most recent call last):
File "C:/python/dsi/venv/telegram.py", line 15, in <module>
bot.polling()
File "C:\python\dsi\venv\lib\site-packages\telebot\__init__.py", line 389, in polling
self.__threaded_polling(none_stop, interval, timeout)
File "C:\python\dsi\venv\lib\site-packages\telebot\__init__.py", line 412, in __threaded_polling
polling_thread.raise_exceptions()
File "C:\python\dsi\venv\lib\site-packages\telebot\util.py", line 78, in raise_exceptions
six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
File "C:\python\dsi\venv\lib\site-packages\six.py", line 693, in reraise
raise value
File "C:\python\dsi\venv\lib\site-packages\telebot\util.py", line 59, in run
task(*args, **kwargs)
File "C:\python\dsi\venv\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:\python\dsi\venv\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:\python\dsi\venv\lib\site-packages\telebot\apihelper.py", line 180, in get_updates
return _make_request(token, method_url, params=payload)
File "C:\python\dsi\venv\lib\site-packages\telebot\apihelper.py", line 54, in _make_request
timeout=(connect_timeout, read_timeout), proxies=proxy)
File "C:\python\dsi\venv\lib\site-packages\requests\sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "C:\python\dsi\venv\lib\site-packages\requests\sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "C:\python\dsi\venv\lib\site-packages\requests\adapters.py", line 337, in send
conn = self.get_connection(request.url, proxies)
File "C:\python\dsi\venv\lib\site-packages\requests\adapters.py", line 241, in get_connection
proxy = proxies.get(urlparse(url.lower()).scheme)
AttributeError: 'set' object has no attribute 'get'
Answer the question
In order to leave comments, you need to log in
apihelper.proxy = {'http': 'http://88.204.154.155:8080'}
"
and closing quotes '
?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question