Skip to main content

Simple & Up-to-date Instagram API

Project description

Ensta

This package lets you use Instagram's Internal API (Web API) through simple methods and classes.

It supports two type of classes - "Guest" and "Host"

"Buy me a coffee"

Installation

Open a terminal window and run this command:

pip install ensta

Guest Mode

It doesn't require any type of login and can be used to fetch publicly available data like Profile Information, Username Availability etc.

from ensta import Guest

guest = Guest()
biography = guest.get_biography("username")

print(biography)

Host Mode

It requires login and can be used to manage your account or fetch information not available without logging in.

from ensta import Host

sessionid = "12345678:abcdefgh"  # Copy SessionId from cookies

host = Host(sessionid)
result = host.follow_username("username")

print(result)

Session ID

To get your instagram SessionId, run the fetch-sessionid.py script.

Alternatively, you can follow these steps if the above method didn't work for you:

  • Open instagram.com in your browser
  • Open DevTools (Ctrl + Shift + I)
  • Go to Application tab
  • Expand Cookies tab, and click on the first item
  • Here you will find your Instagram User's current sessionid.
  • Copy it and pass it as an argument whenever you are using the Host Class.

Examples

1. Check if username is available

from ensta import Guest

guest = Guest()
availability = guest.username_availability("cristiano89724")

print(availability)

Result:

{"success": true, "available": true, "suggestions": ["cristiano89724", "cristiano897241", "cristiano8972441", "cristiano89724367", "cristiano897242760", "cristiano897244", "cristiano8972491", "cristiano89724386", "cristiano897244070", "cristiano8972438", "cristiano89724834"]}



2. Get Biography

from ensta import Guest

guest = Guest()
biography = guest.get_biography("cristiano")

print(biography)

Result:

{"success": true, "biography": "Join my NFT journey on @Binance. Click the link below to get started."}



3. Is Account Verified?

from ensta import Guest

guest = Guest()
verified = guest.is_account_verified("cristiano")

print(verified)

Result:

{"success": true, "verified": true}

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

ensta-1.2.tar.gz (9.6 kB view details)

Uploaded Source

File details

Details for the file ensta-1.2.tar.gz.

File metadata

  • Download URL: ensta-1.2.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for ensta-1.2.tar.gz
Algorithm Hash digest
SHA256 dd1ef6f89878476c80806def6655e0b23394467feb573a19bf4460805d7fd8a2
MD5 f607dd0dbae702f8305b3f306e181111
BLAKE2b-256 22db097dbb02a5b9d30c9c19e875a78564d7347c8ca6bde29f7db2b9e480f4c6

See more details on using hashes here.

Supported by

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