instagrapi
instagrapi copied to clipboard
[BUG] Empty response message when using `signup`
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