Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

instapi

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

instapi

A client interface for the private Instagram API.

  • 0.1.4
  • PyPI
  • Socket score

Maintainers
1

Instagram Private API

Build Status Documentation Status PyPI Code style: black

A Python wrapper for the Instagram private API with no 3rd party dependencies.

Overview

I wrote this to access Instagram's API when they clamped down on developer access. Because this is meant to achieve parity with the official public API, methods not available in the public API will generally have lower priority.

Problems? Please check the docs before submitting an issue.

Features

Documentation

Documentation is available at instapi.rtfd.io.

Install

Install with pip:

pip install instapi

To update:

pip install instapi --upgrade

To update with latest repo code:

pip install instapi --upgrade --force-reinstall

Tested on Python 3.

Usage

The app API client emulates the official app and has a larger set of functions.

The examples/ and tests/ are a good source of detailed sample code on how to use the clients, including a simple way to save the auth cookie for reuse.

Use the official app's API


from instapi import Client, ClientCompatPatch

user_name = 'YOUR_LOGIN_USER_NAME'
password = 'YOUR_PASSWORD'

api = Client(user_name, password)
results = api.feed_timeline()
items = [item for item in results.get('feed_items', [])
         if item.get('media_or_ad')]
for item in items:
    # Manually patch the entity to match the public api as closely as possible, optional
    # To automatically patch entities, initialise the Client with auto_patch=True
    ClientCompatPatch.media(item['media_or_ad'])
    print(item['media_or_ad']['code'])

Avoiding Re-login

You are advised to persist/cache the auth cookie details to avoid logging in every time you make an api call. Excessive logins is a surefire way to get your account flagged for removal. It's also advisable to cache the client details such as user agent, etc together with the auth details.

The saved auth cookie can be reused for up to 90 days.

Support

Make sure to review the contributing documentation before submitting an issue report or pull request.

Disclaimer: This is not affliated, endorsed or certified by Instagram. This is an independent and unofficial API. Strictly not for spam. Use at your own risk.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc