1

I want to build a tool like hootsuide for my own stuff. As you know, Instagram only allows instagram partners to publish a content via api.

I use instapy as a single python file but I've never used with django before. I'm having some troubles with integration.

views.py :

from django.shortcuts import render, redirect
from instapy import InstaPy
# Create your views here.

def instapy_login(request):
    session = InstaPy(username='test', password='test')
    session.login()
    return redirect("/")

However, I want to use this login credentials for next requests. For example :

def fetch_followers(request):
    session = InstaPy(username='test', password='test') # I don't want to login again.
    session.login() # I don't want to login again.
    followers = session.grab_followers(username="test", amount="full")
    print(followers)
    return redirect("/")

I don't want to login in every request. Any idea about fixing it? Thanks alot!

Oxibital
  • 135
  • 1
  • 2
  • 10

1 Answers1

0

I am also new to django but i think pass instapy_login to your function in which you want to use