Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't login with instabot

I'm having problems with instabot. I want to upload an image but it gives me an error

My code:

bot = Bot()
bot.login(username=username, password=password)
bot.upload_photo(image,caption='title')

Error:

line 23, in <module> bot.login(username=username, password=password)
line 443, in login if self.api.login(**args) is False
line 240, in login self.load_uuid_and_cookie(load_cookie=use_cookie, load_uuid=use_uuid)
line 199, in load_uuid_and_cookie return load_uuid_and_cookie(self, load_uuid=load_uuid, load_cookie=load_cookie)
line 352, in load_uuid_and_cookie
cookie_username = self.cookie_dict["ds_user"]
KeyError: 'ds_user'
like image 344
F8te Avatar asked Mar 25 '21 06:03

F8te


1 Answers

From what I understood the part that makes the cookie does not write details about the user. so I recommend deleting the the json file in the config directory at the start of your code:

import os 
import glob
cookie_del = glob.glob("config/*cookie.json")
os.remove(cookie_del[0])
like image 60
SpaceSloth Avatar answered Sep 18 '22 23:09

SpaceSloth