Ad Code

Post A Picture Automatically On Instagram Using Python.


Post a Picture automatically on Instagram Using Python.

Welcome to CodingFizz,


In this tutorial, we will write some interesting lines of code for posting a photo automatically on your Instagram account or profile using Python Programming language.

Instagram is a picture and video-sharing platform. Python provides a powerful tool to interact with Instagram.

Step 1:

Install "instabot" package using the below command in the terminal.

 pip install instabot

Step 2: 

Import class "Bot" from "instabot" package.

 from instabot import Bot

Step 3:

Create a variable let’s say "a" and store the class "Bot" in it.

 a = Bot()

Step 4:

Log in to your Instagram using the below-given command. Put your Instagram "Username" and "Password".

 a.login(username = "******",password = "ppppppp")

Step 5:

Upload your photo using the following command.

 a.upload_photo("provide the path to the picture here",caption = "provide the caption that you \want to display on the post here")

Below is the full code of automatically uploading photos on Instagram using Python.

Complete Code:

 from instabot import Bot
 a = Bot()
 a.login(username = "user_name",password = "user_password")

"""Recommended to put the photo you want to upload in the same directory where this Pyth
on code 
is located else you will have
to provide a full path for the photo."""
 a.upload_photo("Shivam-Maurya-2021.jpg",caption ="Shiavm Maurya 2021")
Below is the screenshot of the post on Instagram of the above photo. 


Post a Comment

0 Comments

Ad Code