T
T
TABSEK2022-01-14 13:10:10
Python
TABSEK, 2022-01-14 13:10:10

How to enable proxy in instabot python?

Hello! It was necessary to connect a proxy to the bot from the "instabot" library, but after updating everything to the latest version and following the instructions , nothing happened, it gives the error "AttributeError: 'dict' object has no attribute 'decode'",

pr = "http://user:[email protected]:port"
PROXY= {
    'http_proxy':pr,
    'https_proxy':pr
        }
bot = Bot()
bot.login(username = Login, password = Password, use_cookie = False, proxy= PROXY)
IdUserList = bot.get_user_following(Login)


Mistake:
Traceback (most recent call last):
  File "main.py", line 81, in <module>
    main()
  File "main.py", line 74, in main
    UsernameList = getUserNameList()
  File "main.py", line 26, in getUserNameList
    bot.login(username = Login, password = Password, use_cookie = False, proxy= PROXY)
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\instabot\bot\bot.py", line 443, in login
    if self.api.login(**args) is False:
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\instabot\api\api.py", line 226, in login
    self.set_proxy()  # Only happens if `self.proxy`
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\instabot\api\api.py", line 465, in set_proxy
    parsed = urllib.parse.urlparse(self.proxy)
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\urllib\parse.py", line 372, in urlparse
    url, scheme, _coerce_result = _coerce_args(url, scheme)
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\urllib\parse.py", line 124, in _coerce_args
    return _decode_args(args) + (_encode_result,)
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\urllib\parse.py", line 108, in _decode_args
    return tuple(x.decode(encoding, errors) if x else '' for x in args)
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\urllib\parse.py", line 108, in <genexpr>
    return tuple(x.decode(encoding, errors) if x else '' for x in args)
AttributeError: 'dict' object has no attribute 'decode'


Tell me what could be the problem? Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question