Skip to content

Commit

Permalink
Implement forced relogin [#287] fix relogin
Browse files Browse the repository at this point in the history
  • Loading branch information
adw0rd committed Aug 20, 2021
1 parent 82f20e8 commit c787a39
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion instagrapi/mixins/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def login(self, username: str, password: str, relogin: bool = False, verificatio
# if self.user_id and self.last_login:
# if time.time() - self.last_login < 60 * 60 * 24:
# return True # already login
if self.user_id:
if self.user_id and not relogin:
return True # already login
try:
self.pre_login_flow()
Expand Down
4 changes: 2 additions & 2 deletions instagrapi/mixins/private.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ def _send_private_request(
self.private.headers.update(headers)
if not login:
time.sleep(self.request_timeout)
if self.user_id and login:
raise Exception(f"User already logged ({self.user_id})")
# if self.user_id and login:
# raise Exception(f"User already logged ({self.user_id})")
try:
if not endpoint.startswith('/'):
endpoint = f"/v1/{endpoint}"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

setup(
name='instagrapi',
version='1.11.0',
version='1.11.1',
author='Mikhail Andreev',
author_email='[email protected]',
license='MIT',
Expand Down
3 changes: 2 additions & 1 deletion tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,8 @@ def test_upload_photo_story(self):
self.assertIsInstance(story, Story)
self.assertTrue(story)
finally:
cleanup(path)
if path:
cleanup(path)
self.assertTrue(self.api.story_delete(story.id))

def test_upload_video_story(self):
Expand Down

0 comments on commit c787a39

Please sign in to comment.