Getting Started
Installation
Install instagrapi with pip:
python -m pip install instagrapi
Supported runtime:
Python 3.10+Python 3.9support was dropped in2.5.0β pin toinstagrapi==2.4.5if you need it.
Introduction
instagrapi is an unofficial Instagram API wrapper for Python. It combines public web and private mobile flows, supports session persistence and challenge handling, and exposes a broad set of primitives for users, media, stories, direct messages, notes, uploads, and insights.
A good first production habit is to avoid password login on every run. Prefer:
from instagrapi import Client
cl = Client()
cl.login(USERNAME, PASSWORD)
cl.dump_settings("session.json")
Then on the next run:
from instagrapi import Client
cl = Client()
cl.load_settings("session.json")
cl.login(USERNAME, PASSWORD)