Open RoyalBosS-Ayush opened 2 years ago
Hello @RoyalBosS-Ayush, I had the same problem, so I created a logic to check if the login is ok.
from os.path import exists
@staticmethod
def __get_client() -> Client:
client = Client()
if exists('./tmp/dump.json'):
loaded_settings = client.load_settings('./tmp/dump.json')
# validate if client is logged
if not loaded_settings.get('last_login'):
remove('./tmp/dump.json')
# recursive call
return UserService.__get_client()
else:
client.login(os.environ.get("INSTAGRAM_USER"), os.environ.get("INSTAGRAM_USER_PASSWORD"))
client.dump_settings('./tmp/dump.json')
return client
How does it solve the issue? Instagram will still log me out and i'll have to solve challenge to continue using id.
Describe the bug I do a new login. Save settings in file. Next time I load settings and login through that (no new session created). After Two or Three days, Instagram otp challenge appears. I use
cl.media_pk_from_url
cl.media_info
cl.story_pk_from_url
cl.story_info
cl.cl.user_info_by_username
with time gap (max 50 requests in a day)To Reproduce
Expected behavior login_required error
Desktop (please complete the following information):
Additional context I am asked to login by solving otp challenge (mostly sms otp) after 2 or 3 days from the day i created session.