Reputation: 23
I have been using these lines of code. But this error appeared
'Bot' object has no attribute 'set_proxy'
I have tried to use it without proxy but then I got this error ERROR - Request returns 429 error!
from instabot import Bot
import time
def unfollow_users(username, password, users_to_unfollow, unfollow_interval=60, proxy=None):
bot = Bot()
# Set proxy if provided
if proxy:
bot.set_proxy(proxy)
bot.login(username=username, password=password)
for user_to_unfollow in users_to_unfollow:
user_id = bot.get_user_id_from_username(user_to_unfollow)
if user_id:
bot.unfollow(user_id)
print(f"Unfollowed {user_to_unfollow}")
time.sleep(unfollow_interval)
else:
print(f"User {user_to_unfollow} not found")
bot.logout()
if __name__ == "__main__":
# Your Instagram credentials
instagram_username = 'usernm'
instagram_password = 'pass'
# List of usernames to unfollow
users_to_unfollow = ["user1id", "user2id", "user3id"]
# Time interval between unfollow actions (in seconds)
unfollow_interval_seconds = 60
# Proxy configuration (replace with your actual proxy details)
proxy_config = {
'http': 'http://212.193.137.206:62740:NReJKktP:vjTr2QJC',
'https': 'https://185.81.71.172:63310:NReJKktP:vjTr2QJC',
}
# Call the function to unfollow users with proxy support
unfollow_users(instagram_username, instagram_password, users_to_unfollow, unfollow_interval_seconds, proxy_config)
TERMINAL RESULT:
PS D:\instagram unfollow> & C:/Users/User/AppData/Local/Programs/Python/Python311/python.exe "d:/instagram unfollow/main.py"
2024-01-15 18:38:00,316 - INFO - Instabot version: 0.117.0 Started
Traceback (most recent call last):
File "d:\instagram unfollow\main.py", line 42, in <module>
unfollow_users(instagram_username, instagram_password, users_to_unfollow, unfollow_interval_seconds, proxy_config)
File "d:\instagram unfollow\main.py", line 9, in unfollow_users
bot.set_proxy(proxy)
^^^^^^^^^^^^^
AttributeError: 'Bot' object has no attribute 'set_proxy'
I have installed PIP and everything needed(BTW my python version is 3.11.4)
Upvotes: 1
Views: 73
Reputation: 4096
Your python version is 3.11.4 but the stable release of instabot
currently supports Python 2.7, 3.5 - 3.7. You may need to downgrade your python version.
Please keep your current python version and also install a supported version. Then use a virtual environment to manage this project. For example, you can use a python 3.7 virtual environment for this project after installing python 3.7 in your system.
Then you can pip install instabot
in your virtual environment. See Project description.
Upvotes: 2