Python Forum
Avoiding Re-login - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Avoiding Re-login (/thread-34867.html)



Avoiding Re-login - Goodsayan - Sep-09-2021

hi,

I try to use this
https://github.com/ping/instagram_private_api

I managed to successfully login to my account with
 
from instagram_private_api import Client, ClientCompatPatch
 
user_name = 'user_name'
password = 'password'
 
api = Client(user_name, password)
results = api.feed_timeline()
items = results.get('items', [])
for item in items:
    # Manually patch the entity to match the public api as closely as possible, optional
    # To automatically patch entities, initialise the Client with auto_patch=True
    ClientCompatPatch.media(item)
    print(media['code'])
It is specified that it is necessary to avoid connecting each time and an example is given.
https://github.com/ping/instagram_private_api/blob/master/examples/savesettings_logincallback.py

How can I use it simply?

Thanks for your help