Open oluca opened 2 years ago
Hey guys,
i have the problem that i cant login through login() and following code fixed it for me:
def login(self, username: str, password: str) -> dict: url = 'https://www.instagram.com/data/shared_data/' login_url = 'https://www.instagram.com/accounts/login/ajax/' time = int(datetime.now().timestamp()) session = requests.Session() response = session.get(url) csrf = json.loads(response.text)['config']['csrf_token']
There is no 'csrf_token' now in response, because instagram change login page and 'csrf_token' is generated dynamically in JavaScript 'window._sharedData'. So to get this token you can use Selenium
Hey guys,
i have the problem that i cant login through login() and following code fixed it for me: