
How to post a picture on Instagram automatically using bot in python?
STEP 1:
Install ‘Instabot’ package using the below command.
pip install instabot
STEP 2:
Import class ‘Bot’ from ‘Instabot’ package.
Command: from instabot import Bot
STEP 3:
Create a variable let’s say ‘bot’ and store the class ‘Bot’ in it.
Command: bot=Bot()
STEP 4:
Login to your Instagram account using the below command. Provide your Instagram ‘username’ and ‘password’.
Command: bot login(username =”xxxxx”, password = “yyyyyy”)
STEP 5:
Upload your photo using the following command.
Command: bot.upload_photo(” provide the path to the picture here”, caption = ” provide the caption”)
CODE
from instabot import Bot
bot= Bot()
bot login(username=”user_name”, password= ” user_password”)
#Recommended to put the photo you want to upload the same directory where this Python code is located else you will have to provide full path for the photo
bot.upload_photo(“IMG2019829-2019.jpg”, caption = ” Make someone smile everyday. Don’t forget that you are someone too..”)
TIP OF THE DAY:
How to display the calendar using python?
import calendar
year= int( input(“Enter the year: “))
month= int( input( “Enter the month: “))
print(calendar.month(year,month))
This is a simple code to print calendar. We are just importing calendar and giving inputs. So you need to give input 2020 for year and 06 for month and you will see the output on the screen.
