Every time i want to follow/ login to my account I get the error "challenge_required"
My Code:
from instagrapi import Client
cl = Client()
cl.login(MY_ACC, MY_PASS)
Follow = input(str("Who should I follow?: "))
# follow
userid = cl.user_id_from_username(Follow)
cl.user_follow(userid)
print("Done!")
logout()
My output:
Traceback (most recent call last):
File "C:\Users\Deggi\AppData\Local\Programs\Python\Python310\lib\site-packages\instagrapi\mixins\private.py", line 298, in _send_private_request
response.raise_for_status()
File "C:\Users\Deggi\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 960, 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/friendships/create/37999660686/
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Deggi\AppData\Local\Programs\Python\Python310\lib\site-packages\instagrapi\mixins\private.py", line 432, in private_request
self._send_private_request(endpoint, **kwargs)
File "C:\Users\Deggi\AppData\Local\Programs\Python\Python310\lib\site-packages\instagrapi\mixins\private.py", line 330, in _send_private_request
raise ChallengeRequired(**last_json)
instagrapi.exceptions.ChallengeRequired: challenge_required
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Deggi\AppData\Local\Programs\Python\Python310\lib\site-packages\instagrapi\mixins\private.py", line 298, in _send_private_request
response.raise_for_status()
File "C:\Users\Deggi\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 960, 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/friendships/create/37999660686/
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Deggi\Documents\python scripts\ig bot\bot.py", line 8, in <module>
cl.user_follow(userid)
File "C:\Users\Deggi\AppData\Local\Programs\Python\Python310\lib\site-packages\instagrapi\mixins\user.py", line 741, in user_follow
result = self.private_request(f"friendships/create/{user_id}/", data)
File "C:\Users\Deggi\AppData\Local\Programs\Python\Python310\lib\site-packages\instagrapi\mixins\private.py", line 449, in private_request
return self._send_private_request(endpoint, **kwargs)
File "C:\Users\Deggi\AppData\Local\Programs\Python\Python310\lib\site-packages\instagrapi\mixins\private.py", line 330, in _send_private_request
raise ChallengeRequired(**last_json)
instagrapi.exceptions.ChallengeRequired: challenge_required
Every time i want to follow/ login to my account I get the error "challenge_required"
My Code:
My output: