instagrapi
instagrapi copied to clipboard
[BUG] Suspicious activity
Describe the bug Basically instagram detects suspicious activity on my account anytime i post anything. I need to verify my email after each posting session.
To Reproduce `from genericpath import exists from time import sleep from instagrapi import Client import os from PIL import Image
files = os.listdir("Resources/Temp/")
if files != None:
with open("Resources/login.txt","r") as f:
Login = f.readlines()[0]
f.close()
with open("Resources/test.txt","r") as f:
Password = f.readlines()[0]
f.close()
cl = Client()
sleep(10)
cl.login(Login,Password)
for file in files:
sleep(10)
image = Image.open("Resources/Temp/" + file)
if image.size[0] > image.size[1]:
image = image.resize((image.size[1],image.size[1]))
else:
image = image.resize((image.size[0],image.size[0]))
Converted_image = image.convert("RGB")
Converted_image.save("Resources/Temp/" + "Resized" + file.replace("png","jpg") )
os.remove("Resources/Temp/" + file)
cl.photo_upload("Resources/Temp/" + "Resized" +file.replace("png","jpg"),caption= u"😅")
os.remove("Resources/Temp/" + "Resized" + file.replace("png","jpg") )
`
Traceback there isn't
Expected behavior Well it was working for months but now it seems that instagram figured out that something is wrong. It's just really boring to verify email each time my bot posts on my account.
Screenshots Can't provide that rn but i will if it will be needed.
Desktop (please complete the following information):
- OS: [Windows 10 latest]
- Python version [latest(probably doesnt matter)]
- instagrapi version [1.13.3]
Login in the app, try again.
Login in the app, try again.
What do you mean? I'm logging in everyday.
You should not fresh login every time you run the script.
I recommend you to save session settings in a file, and use it for your next session.
import instagrapi
import json
import os
if 'session.json' in os.listdir():
with open('session.json', 'r') as f:
cl_session = json.load(f)
else:
cl_session = {}
cl = instagrapi.Client(cl_session)
cl.login(username, password)
with open('session.json', 'w') as f:
json.dump(cl.get_settings(), f)
Be aware that this session.json file permit anyone to login to your account. Keep it safe.
@ghrlt try to use cl.load_settings
and cl.dump_settings
https://adw0rd.github.io/instagrapi/usage-guide/interactions.html
Okay thanks this seems to be working. Sorry for causing a trouble!