instauto
instauto copied to clipboard
Simple to use wrapper around the private Instagram API, written in Python.
Instauto
instauto is a Python package for automating Instagram, making use of the private Instagram API. instauto tries to have feature parity with the Instagram app.
Overview
Instauto has 3 main api's that can be used: instauto.api, instauto.bot and instauto.helpers. You should probably use instauto.helpers and only start using instauto.api when you actually need its functionality.
Everything in instauto, is based around the 'core' instauto.api package. This package interacts directly with the private Instagram API and contains all functionality. This package is both the most flexible (you can update all requests sent and receive the full response back, for example), but also the most complex. You likely do not need to use this package.
The instauto.helpers package, is an abstraction above the instauto.api pacakge. It offers a little bit less flexibility, but is a lot less complex to use. It also offers typed models.
The instauto.bot package, is another abstraction, but this time over the instauto.helpers package. This package has pretty much no flexibility, but can be set up in 10 lines of Python code.
Installation
The package can be installed with the following pip command:
pip install instauto
Getting started
Below are a few examples for getting stared quickly. After getting started, you'll probably want to take a quick look at the more detailed documentation on readthedocs.
Authentication
You'll want to do this as little as possible. Instagram sees logging in often as a huge red flag.
from instauto.api.client import ApiClient
client = ApiClient(username='your_username', password='your_password')
client.log_in()
Restoring state
Because of that, you can restore your session.
client.save_to_disk('your-savefile.instauto')
client = ApiClient.initiate_from_file('your-savefile.instauto')
Making new friends
Ofcourse instauto also supports (un)following users.
from instauto.helpers.friendships import follow_user, unfollow_user
follow_user(client, username='stan000_')
unfollow_user(client, username='stan000_')
Finding new friends
But before you can follow users, you'll need to find them first.
from instauto.helpers.search import search_username
users = search_username(client, "username", 10)
Retrieving 100 of your followers
Getting a list of users that follow you is also super simple.
from instauto.helpers.friendships import get_followers
followers = get_followers(client, username='your_username', limit=100)
Uploading images
instauto also offers a simple API for uploading images to your feed and story.
from instauto.helpers.post import upload_image_to_feed
upload_image_to_feed(client, './cat.jpg', 'Hello from instauto!')
Looking at your feed
Your feed can't be missing, it's pretty much what Instagram is about, isn't it?
from instato.helpers.feed import get_feed
posts = get_feed(client, 100)
More examples
Looking for something else? We have more examples:
- feed helper functions
- friendship helper functions
- post helper functions
- search helper function
- advanced examples
Stil no look? Submit a feature request!
Support
This is a hobby project, which means sometimes other things take priority. I will review issues and work on issues when I have the time. Spamming new issues, asking for a ton of updates, or things like that, will not speed up the process. It will probably even give me less motivation to work on it :)
If you're looking for paid support, please reach out to me at [email protected].
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
There's an article up on the wiki, that explains how to set up a development environment.
License
Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!