Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Empty response message when using signup #1935

Open
brunobely opened this issue May 23, 2024 · 2 comments
Open

[BUG] Empty response message when using signup #1935

brunobely opened this issue May 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@brunobely
Copy link

Describe the bug
Error Status 400: Empty response message. Maybe enabled Two-factor auth? when using the signup method to create a new account.

To Reproduce
Mostly taken from SignUpTestCase:

  client = Client()
  client.delay_range = [1, 3]
  client.set_proxy('socks5://...')

  # signup() doesn't set device_id but it needs it
  client.device_id = "android-%s" % hashlib.sha256(str(time.time()).encode()).hexdigest()[:16]

  email = '[email protected]'
  display_name = 'John Smith'
  username = 'jsmith123512'
  password = 'can389maw39mxruaj'
  phone_number = '+15559202020'

  user = client.signup(
    username, password, email, phone_number, display_name,
    year=random.randint(1970, 2004),
    month=random.randint(1, 12),
    day=random.randint(1, 28)
  )

Traceback

2024-05-23 11:49:02,420:INFO - https://i.instagram.com/api/v1/consent/get_signup_config/
2024-05-23 11:49:04,130:INFO - None [200] GET https://i.instagram.com/api/v1/consent/get_signup_config/?guid=9c636551-da32-4c5c-9416-9378d5c5fd57&main_account_selected=False (269.0.0.18.75, OnePlus 6T Dev)
2024-05-23 11:49:06,605:INFO - https://i.instagram.com/api/v1/users/check_email/
2024-05-23 11:49:07,580:INFO - None [200] POST https://i.instagram.com/api/v1/users/check_email/ (269.0.0.18.75, OnePlus 6T Dev)
2024-05-23 11:49:10,653:INFO - https://i.instagram.com/api/v1/accounts/send_verify_email/
2024-05-23 11:49:12,275:INFO - None [200] POST https://i.instagram.com/api/v1/accounts/send_verify_email/ (269.0.0.18.75, OnePlus 6T Dev)
Enter code (6 digits) for [redacted] (1): 549160
Enter code "549160" for [redacted] (1 attempts, by 5 seconds)
2024-05-23 11:49:40,619:INFO - https://i.instagram.com/api/v1/accounts/check_confirmation_code/
2024-05-23 11:49:43,393:INFO - None [200] POST https://i.instagram.com/api/v1/accounts/check_confirmation_code/ (269.0.0.18.75, OnePlus 6T Dev)
2024-05-23 11:49:47,801:INFO - https://i.instagram.com/api/v1/accounts/create/
2024-05-23 11:49:48,476:INFO - None [400] POST https://i.instagram.com/api/v1/accounts/create/ (269.0.0.18.75, OnePlus 6T Dev)
2024-05-23 11:49:48,476:ERROR - 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/accounts/create/
Traceback (most recent call last):
  File "/private/var/tmp/_bazel_[redacted]/c1a212f4a3cbc7222015ce889f25da32/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/instagram/cli.runfiles/pypi_instagrapi/site-packages/instagrapi/mixins/private.py", line 359, in _send_private_request
    response.raise_for_status()
  File "/private/var/tmp/_bazel_[redacted]/c1a212f4a3cbc7222015ce889f25da32/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/instagram/cli.runfiles/pypi_requests/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/create/
2024-05-23 11:49:48,479:WARNING - Status 400: Empty response message. Maybe enabled Two-factor auth?
Error creating account: 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/accounts/create/

Expected behavior
A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

  • OS: macOS Ventura 13.6.2
  • Python version: 3.12
  • instagrapi version: 2.1.2
@brunobely brunobely added the bug Something isn't working label May 23, 2024
@zekhoi
Copy link
Contributor

zekhoi commented May 28, 2024

that because instagrapi add more key when send data (thats what i found), so just remove the unrequired data when sending to endpoint accounts/create/

@zekhoi
Copy link
Contributor

zekhoi commented May 28, 2024

that because instagrapi add more key when send data (thats what i found), so just remove the unrequired data when sending to endpoint accounts/create/

see #1938

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants