My Instagram code won't run or open in VS Code

Question:

from instabot import bot

my_instagram bot= instagram Bot()
#login
my_instagram bot.login(username="", password="")

#follow a user
my_instagram bot.follow("python_app_projects")


#follow multiple users
my_instagram bot.follow_users(["coding_for_beginners_", "python.app", "py_beginners"])


#unfollow the non followers
my_instagram bot.unfollow_non_followers()

I’m having issues with my Python Instagram bot. I can’t enter my account using my email and password, and I can’t mass follow and mass unfollow anybody.

Asked By: TechNewbie01

||

Answers:

Incorrect Code

    from instabot import bot

my_instagram bot= instagram Bot()
#login
my_instagram bot.login(username="", password="")

#follow a user
my_instagram bot.follow("python_app_projects")


#follow multiple users
my_instagram bot.follow_users(["coding_for_beginners_", "python.app", "py_beginners"])


#unfollow the non followers
my_instagram bot.unfollow_non_followers()

Problems
Problem1- Your Import Statement was incorrect inplace of bot there should be Bot
Problem2-Object Name for class Bot your named it as my_instagram bot you forgot to add _ between instagram and bot.
problem3-When You are creating object for class Bot you named it as instagram Bot() but there is only Bot

Corrected Code

from instabot import Bot

my_instagram_bot=Bot()
#login
my_instagram_bot.login(username="kushaal_mahajan", password="Lovekushp@1")

#follow a user
my_instagram_bot.follow("python_app_projects")


#follow multiple users
my_instagram_bot.follow_users(["coding_for_beginners_", "python.app", "py_beginners"])


#unfollow the non followers
my_instagram_bot.unfollow_non_followers()
Answered By: Kushaal Mahajan
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.