Skip to main content

A client interface for the private Instagram API.

Project description

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.

Legal

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

instapi-0.1.4.tar.gz (80.7 kB view details)

Uploaded Source

Built Distribution

instapi-0.1.4-py3-none-any.whl (99.0 kB view details)

Uploaded Python 3

File details

Details for the file instapi-0.1.4.tar.gz.

File metadata

  • Download URL: instapi-0.1.4.tar.gz
  • Upload date:
  • Size: 80.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for instapi-0.1.4.tar.gz
Algorithm Hash digest
SHA256 f17a8dc62667f47fcf54f73a4313cc450f075b2e1bbd47e909e358a4fa9edc87
MD5 a27db77b00e2b5ea06a52c18bb5443bb
BLAKE2b-256 5510df6b819c40c0e09ae69ad6e329ae622e2576d57df2475680eab176cc2730

See more details on using hashes here.

File details

Details for the file instapi-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: instapi-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 99.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for instapi-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 189ce69c6bcfb927b903dcdaf8762f28b991ce027648c15dcd5a2f92b42b7c36
MD5 e8d7bb6ec10dff920c20c6129e87e55b
BLAKE2b-256 0aa7d76079a66ee59b6c06a3a3eb36ea1d7236ba77ddb6aeff5092ed21027533

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page