/instagram-graph-api

New port of Instagram graph API, which is provided by facebook

Primary LanguagePythonApache License 2.0Apache-2.0

Graph API

Python library to connect instagram graph API and get data.

Usage

First get an access_token from here

from graph_api import InstagramGraphHandler

# Get account data 
handler = InstagramGraphHandlers(access_token=<your-access_token>, 
                                 account_id=<your-instagram-account-id>)
account_data = handler.account_data.get()

# Get media data
handler = InstagramGraphHandlers(access_token=<your-access_token>, 
                                 media_id=<instagram-media-id>)
media_comments = handler.media_comments.get()

# Pagination support
while handler.media_comments.graph.has_next():
    media_comments.extend(handler.media_comments.get())

##Notes:

  • All .get() API call only return one page response and you should loop over next pages urls.
  • All handlers are available stand alone from graph_api.handler path

##Todo:

  • Add token extender to exchange short-live token to long-live