subzeroid / instagrapi

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

[BUG] ChallengeRequired -> add_birthday #682

Open ghrlt opened 2 years ago

ghrlt commented 2 years ago

Hi! Faced this while login in today. Wasn't able to monitor HTTP requests while completing the challenge on the app :/

Near full traceback:

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/accounts/current_user/?edit=true

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/private.py", line 432, in private_request
    self._send_private_request(endpoint, **kwargs)
  File "/usr/local/lib/python3.10/dist-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 "/root/IGDL/igdl/app.py", line 473, in <module>
    app = InstagramDownloader(username or input("Username: "), password or input("Password: "))
  File "/root/IGDL/igdl/app.py", line 70, in __init__
    self.bot_account = self.bot.account_info()
  File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/account.py", line 57, in account_info
    result = self.private_request("accounts/current_user/?edit=true")
  File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/private.py", line 443, in private_request
    self.challenge_resolve(self.last_json)
  File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/challenge.py", line 78, in challenge_resolve
    return self.challenge_resolve_simple(challenge_url)
  File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/challenge.py", line 425, in challenge_resolve_simple
    raise ChallengeUnknownStep(f'ChallengeResolve: Unknown step_name "{step_name}" for "{self.username}" in challenge resolver: {self.last_json}')
instagrapi.exceptions.ChallengeUnknownStep: ChallengeResolve: Unknown step_name "add_birthday" for "my-username" in challenge resolver: {'step_name': 'add_birthday', 'step_data': {'allow_dismiss': False, 'remove_logout_eligible': True, 'in_us': False, 'is_business': True, 'birthday_message': "We▒re asking for this info to help protect younger people in our community. We▒ll also use your birthday to help personalize your experience, including ads. This won't be part of your public profile.", 'date_joined_timestamp': 1592151534, 'birthday_year': None, 'birthday_month': None, 'birthday_day': None}, 'flow_render_type': 3, 'bloks_action': 'com.instagram.challenge.navigation.take_challenge', 'cni': 1793...7009, 'challenge_context': '{"step_name": "add_birthday", "cni": 1793...7009, "is_stateless": false, "challenge_type_enum": "ADD_BIRTHDAY", "present_as_modal": false}', 'challenge_type_enum_str': 'ADD_BIRTHDAY', 'status': 'ok'}
root@host:~/IGDL/igdl#
adw0rd commented 2 years ago

@ghrlt can you fix it yourself?

ghrlt commented 2 years ago

Would have liked to.

But I am completely unable to monitor HTTP requests from the Instagram app, even using your tutorial or any other available on the web.

However, I might able to do so with an emulator, but I will not be able to try soon.