Instapy: executing the script error

Created on 30 Nov 2017  路  3Comments  路  Source: timgrossmann/InstaPy

from instapy import InstaPy

insta_username = 'username'
insta_password = 'password'

session.follow_user_followers(['natgeo', 'kimkardashian', 'therock'], amount=10, randomize=False, sleep_delay=60)

session.end()

I finally got InstaPy to work but my script isnt working. I tried to just edit the quickstart.py and add in my own information but all the text is encrypted. So i am trying to write out the whole source code manually. These are the commands i am using for my script however when i try to execute via "python script.py" i get this message:
InstaPy$ python script.py
Traceback (most recent call last):
File "script.py", line 7, in
session.follow_user_followers(['kimkardashian', 'natgeo', 'cosplay.world_'], amount=10, randomize=True, sleep_delay=60)
NameError: name 'session' is not defined
lubuntu@lubuntu:~/InstaPy$ python script.py
Traceback (most recent call last):
File "script.py", line 7, in
session.follow_by_list(accs, times=1)
NameError: name 'session' is not defined
lubuntu@lubuntu:~/InstaPy$

could someone explain my mistake or even more help if you could show me the simple commands to get the script to log in and to specifically follow an account i tell to. Thank you.

help wanted

Most helpful comment

You need to add these two lines after you set your username and password in order to define session.
session = InstaPy(username=insta_username, password=insta_password)
session.login()

All 3 comments

You need to add these two lines after you set your username and password in order to define session.
session = InstaPy(username=insta_username, password=insta_password)
session.login()

hey @drcyber975, did you solve it?

Most likely an issue with variable scope. You may be accessing the variable outside the block where session is defined

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tibor picture tibor  路  3Comments

harrypython picture harrypython  路  3Comments

pierrelouis555 picture pierrelouis555  路  3Comments

CharlesCCC picture CharlesCCC  路  3Comments

Naramsim picture Naramsim  路  3Comments