subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.38k stars 685 forks source link

[BUG] raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/accounts/login/ #1873

Open DNL-Dami opened 7 months ago

DNL-Dami commented 7 months ago

I have an 400 Bad request error when try to login and then instagrapi calls https://i.instagram.com/api/v1/accounts/login/ and I get

Traceback (most recent call last): File "C:\Users\DNL-Dami\Documents\CODES\Instragram Bot\env\Lib\site-packages\instagrapi\mixins\private.py", line 359, in _send_private_request response.raise_for_status() File "C:\Users\DNL-Dami\Documents\CODES\Instragram Bot\env\Lib\site-packages\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/accounts/login/

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\Users\DNL-Dami\Documents\CODES\Instragram Bot\bot.py", line 7, in client.login(username, password) File "C:\Users\DNL-Dami\Documents\CODES\Instragram Bot\env\Lib\site-packages\instagrapi\mixins\auth.py", line 441, in login logged = self.private_request("accounts/login/", data, login=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\DNL-Dami\Documents\CODES\Instragram Bot\env\Lib\site-packages\instagrapi\mixins\private.py", line 541, in private_request raise e File "C:\Users\DNL-Dami\Documents\CODES\Instragram Bot\env\Lib\site-packages\instagrapi\mixins\private.py", line 526, in private_request self._send_private_request(endpoint, kwargs) File "C:\Users\DNL-Dami\Documents\CODES\Instragram Bot\env\Lib\site-packages\instagrapi\mixins\private.py", line 382, in _send_private_request raise PleaseWaitFewMinutes(e, response=e.response, last_json) instagrapi.exceptions.PleaseWaitFewMinutes: Please wait a few minutes before you try again.

tajbowness commented 7 months ago

Instagram has banned your session. Create a new session id and relog

https://subzeroid.github.io/instagrapi/usage-guide/interactions.html

https://github.com/subzeroid/instagrapi/blob/master/docs/usage-guide/best-practices.md