Closed returnWOW closed 3 years ago
Please add the following snippet of code and post the output here.
import logging
logging.basicConfig()
logging.getLogger('').setLevel(logging.DEBUG)
Please add the following snippet of code and post the output here.
import logging logging.basicConfig() logging.getLogger('').setLevel(logging.DEBUG)
Hi, thanks for reply, the debug log is :
INFO:instauto.api.client:No state provided. Logging in...
INFO:apscheduler.scheduler:Adding job tentatively -- it will be properly scheduled when the scheduler starts
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): i.instagram.com:443
DEBUG:urllib3.connectionpool:https://i.instagram.com:443 "GET /api/v1/zr/token/result/?device_id=android-013d406a924cd00a&token_hash=&custom_device_id=1f9324ef-013d-406a-924c-d00adfbb05ae&fetch_reason=token_expired HTTP/1.1" 200 204
DEBUG:instauto.api.actions.request:Sent request to https://i.instagram.com/api/v1/zr/token/result/?device_id=android-013d406a924cd00a&token_hash=&custom_device_id=1f9324ef-013d-406a-924c-d00adfbb05ae&fetch_reason=token_expired, method: GET with data:
{}
DEBUG:instauto.api.actions.request:******************** START REQUEST ********************
METHOD: GET
URL: https://i.instagram.com/api/v1/zr/token/result/?device_id=android-013d406a924cd00a&token_hash=&custom_device_id=1f9324ef-013d-406a-924c-d00adfbb05ae&fetch_reason=token_expired
DATA: {}
HEADERS: {'x-ig-connection-type': 'WIFI', 'x-ig-capabilities': '3brTvw8=', 'x-ig-app-id': '567067343352427', 'user-agent': 'Instagram 148.0.0.33.121 Android (29/10.0; 420dpi; 1080x2340; OnePlus; GM1903; GM1903; qcom; nl_NL; 227298996)', 'accept-language': 'nl_NL', 'accept-encoding': 'gzip, deflate', 'x-fb-http-engine': 'Liger', 'x-ig-connection-speed': '2330kbps', 'x-ig-bandwidth-speed-kbps': '3547.603', 'x-ig-bandwidth-totalbytes-b': '0', 'x-ig-bandwidth-totaltime-ms': '0', 'x-ig-www-claim': '0'}
RESPONSE: b'{"token": {"carrier_name": "", "carrier_id": 0, "ttl": 72000, "features": [], "request_time": 1602765375, "token_hash": "", "rewrite_rules": [], "enabled_wallet_defs_keys": [], "deadline": "", "zero_cms_fetch_interval_seconds": 86400, "carrier_signal_config": []}, "status": "ok"}'
******************** END REQUEST ********************
DEBUG:urllib3.connectionpool:https://i.instagram.com:443 "POST /api/v1/qe/sync/ HTTP/1.1" 200 624
DEBUG:instauto.api.actions.request:Sent request to https://i.instagram.com/api/v1/qe/sync/, method: POST with data:
{'_csrftoken': '9lbuTjVueTFonZEwPK2q2wvNmBUBZOQu', 'id': '1f9324ef-013d-406a-924c-d00adfbb05ae', 'sever_config_retrieval': '1', 'experiments': 'ig_android_device_detection_info_upload,ig_android_gmail_oauth_in_reg,ig_android_account_linking_upsell_universe,ig_android_direct_main_tab_universe_v2,ig_android_sign_in_help_only_one_account_family_universe,ig_android_sms_retriever_backtest_universe,ig_android_vc_interop_use_test_igid_universe,ig_android_direct_add_direct_to_android_native_photo_share_sheet,ig_growth_android_profile_pic_prefill_with_fb_pic_2,ig_account_identity_logged_out_signals_global_holdout_universe,ig_android_notification_unpack_universe,ig_android_quickcapture_keep_screen_on,ig_android_device_based_country_verification,ig_android_login_identifier_fuzzy_match,ig_android_reg_modularization_universe,ig_android_video_render_codec_low_memory_gc,ig_android_device_verification_separate_endpoint,ig_android_email_fuzzy_matching_universe,ig_android_suma_landing_page,ig_android_smartlock_hints_universe,ig_android_video_ffmpegutil_pts_fix,ig_android_multi_tap_login_new,ig_android_retry_create_account_universe,ig_android_caption_typeahead_fix_on_o_universe,ig_android_enable_keyboardlistener_redesign,ig_android_reg_nux_headers_cleanup_universe,ig_android_get_cookie_with_concurrent_session_universe,ig_android_nux_add_email_device,ig_android_device_info_foreground_reporting,ig_android_shortcuts_2019,ig_android_device_verification_fb_signup,ig_android_passwordless_account_password_creation_universe,ig_android_black_out_toggle_universe,ig_video_debug_overlay,ig_android_ask_for_permissions_on_reg,ig_assisted_login_universe,ig_android_security_intent_switchoff,ig_android_recovery_one_tap_holdout_universe,ig_android_sim_info_upload,ig_android_mobile_http_flow_device_universe,ig_android_fb_account_linking_sampling_freq_universe,ig_android_access_flow_prefill'}
DEBUG:instauto.api.actions.request:******************** START REQUEST ********************
METHOD: POST
URL: https://i.instagram.com/api/v1/qe/sync/
DATA: {'_csrftoken': '9lbuTjVueTFonZEwPK2q2wvNmBUBZOQu', 'id': '1f9324ef-013d-406a-924c-d00adfbb05ae', 'sever_config_retrieval': '1', 'experiments': 'ig_android_device_detection_info_upload,ig_android_gmail_oauth_in_reg,ig_android_account_linking_upsell_universe,ig_android_direct_main_tab_universe_v2,ig_android_sign_in_help_only_one_account_family_universe,ig_android_sms_retriever_backtest_universe,ig_android_vc_interop_use_test_igid_universe,ig_android_direct_add_direct_to_android_native_photo_share_sheet,ig_growth_android_profile_pic_prefill_with_fb_pic_2,ig_account_identity_logged_out_signals_global_holdout_universe,ig_android_notification_unpack_universe,ig_android_quickcapture_keep_screen_on,ig_android_device_based_country_verification,ig_android_login_identifier_fuzzy_match,ig_android_reg_modularization_universe,ig_android_video_render_codec_low_memory_gc,ig_android_device_verification_separate_endpoint,ig_android_email_fuzzy_matching_universe,ig_android_suma_landing_page,ig_android_smartlock_hints_universe,ig_android_video_ffmpegutil_pts_fix,ig_android_multi_tap_login_new,ig_android_retry_create_account_universe,ig_android_caption_typeahead_fix_on_o_universe,ig_android_enable_keyboardlistener_redesign,ig_android_reg_nux_headers_cleanup_universe,ig_android_get_cookie_with_concurrent_session_universe,ig_android_nux_add_email_device,ig_android_device_info_foreground_reporting,ig_android_shortcuts_2019,ig_android_device_verification_fb_signup,ig_android_passwordless_account_password_creation_universe,ig_android_black_out_toggle_universe,ig_video_debug_overlay,ig_android_ask_for_permissions_on_reg,ig_assisted_login_universe,ig_android_security_intent_switchoff,ig_android_recovery_one_tap_holdout_universe,ig_android_sim_info_upload,ig_android_mobile_http_flow_device_universe,ig_android_fb_account_linking_sampling_freq_universe,ig_android_access_flow_prefill'}
HEADERS: {'x-cm-bandwidth-kbps': '-1.000', 'x-cm-latency': '-1.000', 'x-ads-opt-out': '0', 'x-ig-app-locale': 'nl_NL', 'x-ig-app-startup-country': 'NL', 'x-ig-device-locale': 'nl_NL', 'x-ig-mapped-locale': 'nl_NL', 'x-ig-connection-speed': '3083kbps', 'x-ig-bandwidth-speed-kbps': '3037.504', 'x-ig-bandwidth-totalbytes-b': '0', 'x-ig-bandwidth-totaltime-ms': '0', 'x-ig-www-claim': '0', 'x-ig-device-id': '1f9324ef-013d-406a-924c-d00adfbb05ae', 'x-ig-android-id': 'android-013d406a924cd00a', 'x-ig-connection-type': 'WIFI', 'x-ig-capabilities': '3brTvw8=', 'x-ig-app-id': '567067343352427', 'user-agent': 'Instagram 148.0.0.33.121 Android (29/10.0; 420dpi; 1080x2340; OnePlus; GM1903; GM1903; qcom; nl_NL; 227298996)', 'accept-language': 'nl_NL, en_US', 'x-mid': 'X4hCPwABAAE7zJf2NN9OeFiVR_m8', 'ig-u-rur': '', 'accept-encoding': 'gzip', 'x-fb-http-engine': 'Liger', 'authorization': 'Bearer IGT:2:', 'connection': 'close', 'x-pigeon-session-id': 'b6c690a6-8504-40c6-8145-31e558113d89', 'x-pigeon-rawclienttime': '1602765375.23', 'x-bloks-version-id': '5da07fc1b20eb4c7d1b2e6146ee5f197072cbbd193d2d1eb3bb4e825d3c39e28', 'x-bloks-is-layout-rtl': 'False', 'host': 'i.instagram.com', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
RESPONSE: b'{"experiments": [{"name": "ig_android_gmail_oauth_in_reg", "group": "rollout_1201", "additional_params": [], "params": [{"name": "try_background_confirm", "value": "true"}]}, {"name": "ig_android_account_linking_upsell_universe", "group": "control", "additional_params": [], "params": [{"name": "logout_impression_limit", "value": "0"}]}, {"name": "ig_android_direct_add_direct_to_android_native_photo_share_sheet", "group": "test", "additional_params": [], "params": [{"name": "is_enabled", "value": "true"}]}, {"name": "ig_account_identity_logged_out_signals_global_holdout_universe", "group": "test", "additional_params": [], "params": [{"name": "auto_confirm_use_big_blue_token", "value": "false"}, {"name": "auto_confirm_use_uig", "value": "false"}, {"name": "auto_confirm_use_signals", "value": "false"}]}, {"name": "ig_android_quickcapture_keep_screen_on", "group": "test", "additional_params": [], "params": [{"name": "keep_screen_on_enabled", "value": "true"}]}, {"name": "ig_android_video_render_codec_low_memory_gc", "group": "control", "additional_params": [], "params": [{"name": "gc_before_codec_init", "value": "false"}]}, {"name": "ig_android_video_ffmpegutil_pts_fix", "group": "test", "additional_params": [], "params": [{"name": "retry_count", "value": "5"}]}, {"name": "ig_android_multi_tap_login_new", "group": "test", "additional_params": [], "params": [{"name": "show_logged_out_only", "value": "true"}, {"name": "enabled", "value": "true"}]}, {"name": "ig_android_get_cookie_with_concurrent_session_universe", "group": "test", "additional_params": [], "params": [{"name": "is_enabled", "value": "true"}]}, {"name": "ig_android_passwordless_account_password_creation_universe", "group": "control", "additional_params": [], "params": [{"name": "upsell_for_mac_flow", "value": "false"}, {"name": "show_save_password_checkbox", "value": "false"}]}, {"name": "ig_android_black_out_toggle_universe", "group": "control", "additional_params": [], "params": [{"name": "is_enabled_oreo", "value": "false"}, {"name": "is_enabled", "value": "false"}, {"name": "is_enabled_pie", "value": "false"}, {"name": "is_enabled_q_plus", "value": "false"}]}, {"name": "ig_android_security_intent_switchoff", "group": "allusers", "additional_params": [], "params": [{"name": "switch_offs", "value": ""}]}, {"name": "ig_android_sim_info_upload", "group": "test", "additional_params": [], "params": [{"name": "enable_upload", "value": "true"}]}, {"name": "ig_android_fb_account_linking_sampling_freq_universe", "group": "control", "additional_params": [], "params": [{"name": "freq", "value": "100"}]}], "status": "ok"}'
******************** END REQUEST ********************
DEBUG:urllib3.connectionpool:Resetting dropped connection: i.instagram.com
DEBUG:urllib3.connectionpool:https://i.instagram.com:443 "POST /api/v1/accounts/login/ HTTP/1.1" 400 458
DEBUG:instauto.api.actions.request:Sent request to https://i.instagram.com/api/v1/accounts/login/, method: POST with data:
{'ig_sig_key_version': '4', 'signed_body': 'SIGNATURE.{"jazoest": "22338", "phone_id": "0b623bf5-a259-47c3-99b0-08969b7db6a8", "device_id": "android-013d406a924cd00a", "guid": "1f6ca62a-ed39-4857-aa67-9871b0375d71", "_csrftoken": "9lbuTjVueTFonZEwPK2q2wvNmBUBZOQu", "adid": "98a75b3d-f2db-4618-bfc4-daf2e3040bf4", "google_tokens": "[]", "username": "xxx", "country_codes": "[{\\"country_code\\":\\"31\\",\\"source\\": \\"default\\"}]", "enc_password": "#PWD_INSTAGRAM:4:1602765375:/ZTZvuf3rdZbedCU9Xk77sb02phBFbAZl8DS2uZHVGzkMkShf/smUaeqDcKNECnFUnpRpb7Gkzey3iCb8/PB70nIZEE3qiKUeLypCIU6c8r++lkBbiTz/A0PoXYU7s4iSTnSgAdMQE+3mTFyEeeGAt5vbVl4RVweGSwAWKguX7O1DUv5/uiIslwVv7s0vXx9MESZINmBbvFvpBeOebnw0i4RbhVEPUgdixWT0MX71NRnYu7FSCG4179CfbHOgoN93gT+KEoFtj8hHOETNF25TnIpulSpPvEd4QYdWEh+2D+vG0bLwNisM0=", "login_attempt_count": "0"}'}
DEBUG:instauto.api.actions.request:******************** START REQUEST ********************
METHOD: POST
URL: https://i.instagram.com/api/v1/accounts/login/
DATA: {'ig_sig_key_version': '4', 'signed_body': 'SIGNATURE.{"jazoest": "22338", "phone_id": "0b623bf5-a259-47c3-99b0-08969b7db6a8", "device_id": "android-013d406a924cd00a", "guid": "1f6ca62a-ed39-4857-aa67-9871b0375d71", "_csrftoken": "9lbuTjVueTFonZEwPK2q2wvNmBUBZOQu", "adid": "98a75b3d-f2db-4618-bfc4-daf2e3040bf4", "google_tokens": "[]", "username": "xxx", "country_codes": "[{\\"country_code\\":\\"31\\",\\"source\\": \\"default\\"}]", "enc_password": "#PWD_INSTAGRAM:4:1602765375:/ZTZvuf3rdZbedCU9Xk77sb02phBFbAZl8DS2uZHVGzkMkShf/smUaeqDcKNECnFUnpRpb7Gkzey3iCb8/PB70nIZEE3qiKUeLypCIU6c8r++lkBbiTz/A0PoXYU7s4iSTnSgAdMQE+3mTFyEeeGAt5vbVl4RVweGSwAWKguX7O1DUv5/uiIslwVv7s0vXx9MESZINmBbvFvpBeOebnw0i4RbhVEPUgdixWT0MX71NRnYu7FSCG4179CfbHOgoN93gT+KEoFtj8hHOETNF25TnIpulSpPvEd4QYdWEh+2D+vG0bLwNisM0=", "login_attempt_count": "0"}'}
HEADERS: {'x-cm-bandwidth-kbps': '-1.000', 'x-cm-latency': '-1.000', 'x-ads-opt-out': '0', 'x-ig-app-locale': 'nl_NL', 'x-ig-app-startup-country': 'NL', 'x-ig-device-locale': 'nl_NL', 'x-ig-mapped-locale': 'nl_NL', 'x-ig-connection-speed': '2065kbps', 'x-ig-bandwidth-speed-kbps': '2565.106', 'x-ig-bandwidth-totalbytes-b': '0', 'x-ig-bandwidth-totaltime-ms': '0', 'x-ig-www-claim': '0', 'x-ig-device-id': '1f9324ef-013d-406a-924c-d00adfbb05ae', 'x-ig-android-id': 'android-013d406a924cd00a', 'x-ig-connection-type': 'WIFI', 'x-ig-capabilities': '3brTvw8=', 'x-ig-app-id': '567067343352427', 'user-agent': 'Instagram 148.0.0.33.121 Android (29/10.0; 420dpi; 1080x2340; OnePlus; GM1903; GM1903; qcom; nl_NL; 227298996)', 'accept-language': 'nl_NL, en_US', 'x-mid': 'X4hCPwABAAE7zJf2NN9OeFiVR_m8', 'ig-u-rur': '', 'accept-encoding': 'gzip', 'x-fb-http-engine': 'Liger', 'authorization': 'Bearer IGT:2:', 'connection': 'close', 'x-pigeon-session-id': 'b6c690a6-8504-40c6-8145-31e558113d89', 'x-pigeon-rawclienttime': '1602765375.584', 'x-bloks-version-id': '5da07fc1b20eb4c7d1b2e6146ee5f197072cbbd193d2d1eb3bb4e825d3c39e28', 'x-bloks-is-layout-rtl': 'False', 'host': 'i.instagram.com', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
RESPONSE: b'{"message": "challenge_required", "challenge": {"url": "https://i.instagram.com/challenge/191812614/KLA5k08OFa/", "api_path": "/challenge/191812614/KLA5k08OFa/", "hide_webview_header": true, "lock": true, "logout": false, "native_flow": true, "flow_render_type": 0, "challenge_context": "{\\"step_name\\": \\"\\", \\"nonce_code\\": \\"KLA5k08OFa\\", \\"user_id\\": 191812614, \\"is_stateless\\": false}"}, "status": "fail", "error_type": "checkpoint_challenge_required"}'
******************** END REQUEST ********************
DEBUG:urllib3.connectionpool:Resetting dropped connection: i.instagram.com
DEBUG:urllib3.connectionpool:https://i.instagram.com:443 "GET /api/v1/challenge/191812614/KLA5k08OFa/?guid=1f6ca62a-ed39-4857-aa67-9871b0375d71&device_id=1f9324ef-013d-406a-924c-d00adfbb05ae HTTP/1.1" 500 25
DEBUG:instauto.api.actions.request:Sent request to https://i.instagram.com/api/v1/challenge/191812614/KLA5k08OFa/?guid=1f6ca62a-ed39-4857-aa67-9871b0375d71&device_id=1f9324ef-013d-406a-924c-d00adfbb05ae, method: GET with data:
{}
DEBUG:instauto.api.actions.request:******************** START REQUEST ********************
METHOD: GET
URL: https://i.instagram.com/api/v1/challenge/191812614/KLA5k08OFa/?guid=1f6ca62a-ed39-4857-aa67-9871b0375d71&device_id=1f9324ef-013d-406a-924c-d00adfbb05ae
DATA: {}
HEADERS: {'x-cm-bandwidth-kbps': '-1.000', 'x-cm-latency': '-1.000', 'x-ads-opt-out': '0', 'x-ig-app-locale': 'nl_NL', 'x-ig-app-startup-country': 'NL', 'x-ig-device-locale': 'nl_NL', 'x-ig-mapped-locale': 'nl_NL', 'x-ig-connection-speed': '3375kbps', 'x-ig-bandwidth-speed-kbps': '3473.915', 'x-ig-bandwidth-totalbytes-b': '0', 'x-ig-bandwidth-totaltime-ms': '0', 'x-ig-www-claim': '0', 'x-ig-device-id': '1f9324ef-013d-406a-924c-d00adfbb05ae', 'x-ig-android-id': 'android-013d406a924cd00a', 'x-ig-connection-type': 'WIFI', 'x-ig-capabilities': '3brTvw8=', 'x-ig-app-id': '567067343352427', 'user-agent': 'Instagram 148.0.0.33.121 Android (29/10.0; 420dpi; 1080x2340; OnePlus; GM1903; GM1903; qcom; nl_NL; 227298996)', 'accept-language': 'nl_NL, en_US', 'x-mid': 'X4hCPwABAAE7zJf2NN9OeFiVR_m8', 'ig-u-rur': '', 'accept-encoding': 'gzip', 'x-fb-http-engine': 'Liger', 'authorization': 'Bearer IGT:2:', 'connection': 'close', 'x-pigeon-session-id': 'b6c690a6-8504-40c6-8145-31e558113d89', 'x-pigeon-rawclienttime': '1602765379.05', 'x-bloks-version-id': '5da07fc1b20eb4c7d1b2e6146ee5f197072cbbd193d2d1eb3bb4e825d3c39e28', 'x-bloks-is-layout-rtl': 'False', 'host': 'i.instagram.com'}
RESPONSE: b'Oops, an error occurred.\n'
******************** END REQUEST ********************
ERROR:instauto.api.actions.request:response received:
Oops, an error occurred.
url: https://i.instagram.com/api/v1/challenge/191812614/KLA5k08OFa/?guid=1f6ca62a-ed39-4857-aa67-9871b0375d71&device_id=1f9324ef-013d-406a-924c-d00adfbb05ae
status code: 500
Traceback (most recent call last):
File "E:\project\insbot_demo2\test\venv\lib\site-packages\instauto\api\actions\request.py", line 240, in _check_response_for_errors
parsed = resp.json()
File "E:\project\insbot_demo2\test\venv\lib\site-packages\requests\models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\returnwow\AppData\Local\Programs\Python\Python38\lib\json\__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "C:\Users\returnwow\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\returnwow\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "E:\project\insbot_demo2\test\venv\lib\site-packages\instauto\api\actions\request.py", line 240, in _check_response_for_errors
parsed = resp.json()
File "E:\project\insbot_demo2\test\venv\lib\site-packages\requests\models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\returnwow\AppData\Local\Programs\Python\Python38\lib\json\__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "C:\Users\returnwow\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\returnwow\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "new_test_login.py", line 32, in <module>
client.login()
File "E:\project\insbot_demo2\test\venv\lib\site-packages\instauto\api\actions\authentication.py", line 64, in login
resp = self._request('accounts/login/', Method.POST, data=data2, signed=True)
File "E:\project\insbot_demo2\test\venv\lib\site-packages\instauto\api\actions\request.py", line 231, in _request
self._check_response_for_errors(resp)
File "E:\project\insbot_demo2\test\venv\lib\site-packages\instauto\api\actions\request.py", line 257, in _check_response_for_errors
eh = self._handle_challenge(resp)
File "E:\project\insbot_demo2\test\venv\lib\site-packages\instauto\api\actions\challenge.py", line 29, in _handle_challenge
_ = self._request(endpoint=api_path, method=Method.GET, query={
File "E:\project\insbot_demo2\test\venv\lib\site-packages\instauto\api\actions\request.py", line 231, in _request
self._check_response_for_errors(resp)
File "E:\project\insbot_demo2\test\venv\lib\site-packages\instauto\api\actions\request.py", line 247, in _check_response_for_errors
raise BadResponse("Received a non-200 response from Instagram")
instauto.api.exceptions.BadResponse: Received a non-200 response from Instagram
I believe this challenge is a simple one, where you just need to confirm a previous login was you. Currently, only challenges where you need to verify your phone/email are supported.
Yeah,I have also encountered this situation and this error occurred. The possible reason is that I am logging in from a different place, and then I am asked to confirm that this login is my own operation, and I can log in only after I click Confirm. However, this version does not seem to have this feature, so an error occurred. Please help the author to solve it, I am waiting for your reply,Best wishes.
Hello,When can this problem be solved? I am looking forward to your reply..
@stanvanrooy Hello,When can this problem be solved? now I can not get login now, I am looking forward to your reply..
I'll start work on this when I can find the time.
@stanvanrooy I am waiting for your solve.I can not get login now because of it. come on ,boy
I do not have the time right now. https://github.com/stanvanrooy/instauto/commit/caca72ddbecf9ad959ef6660209d34b73d325449 here you can find working code for completing this type of challenge.
If you really need it, you can add that in yourself.
You just need to find a way to differentiate between phone/email and basic challenges.
@stanvanrooy Hello,I tried to solve this bug, but it still failed. Can you help me solve it? I believe you will be able to solve it soon. Compared to you, this problem is not particularly troublesome, is it? I hope you can help me solve it, thanks a lot.
@stanvanrooy Hello?help me,please.ok?
@stanvanrooy why not reply me?
Hello,I don't know how to find a way to differentiate between phone/email and basic challenges. Can you help me,please.now I can not get login for different place,I need your help very much! tks!!!
@stanvanrooy Hello,I don't know how to find a way to differentiate between phone/email and basic challenges. Can you help me,please.now I can not get login for different place,I need your help very much! tks!!!
I do not have the time right now. caca72d here you can find working code for completing this type of challenge.
If you really need it, you can add that in yourself.
You just need to find a way to differentiate between phone/email and basic challenges.
Hello! I try to fix this, in some case server requery some other logged devices to confirm send the verification code to email(like to confirm this was me). In this case the choice equal to 1, like below:
b'{"step_name": "select_verify_method", "step_data": {"choice": "1", "fb_access_token": "None", "big_blue_token": "None", "google_oauth_token": "true", "vetted_device": "None", "email": "l*******g@o*****.com"}, "flow_render_type": 3, "bloks_action": "com.instagram.challenge.navigation.take_challenge", "nonce_code": "***", "user_id": ***, "challenge_context": "{\\"step_name\\": \\"select_verify_method\\", \\"nonce_code\\": \\"***\\", \\"user_id\\": ***, \\"is_stateless\\": false}", "status": "ok"}'
Modify the challenge code and the verification code has send to email, and enter the code to the running input interface and server response 200, but login still error:
class ChallengeMixin:
ig_profile: IGProfile
device_profile: DeviceProfile
state: State
_session: requests.Session
_request: _request
def _handle_challenge(self, resp: requests.Response) -> bool:
resp_data = resp.json()
print("auth data1\n{}".format(resp_data))
if resp_data['message'] not in ('challenge_required', 'checkpoint_required'):
raise BadResponse("Challenge required, but no URL provided.")
api_path = resp_data['challenge']['api_path'][1:]
resp_data2 = self._request(endpoint=api_path, method=Method.GET, query={
"guid": self.state.uuid,
"device_id": self.state.device_id
}
)
# TODO: Add support for different kinds of challenges.
# Currently, only the verification pin challenge is supported, and other challenges, such as the
# 'verify this was you', do not work.
resp_json2 = resp_data2.json()
if int(resp_json2.get("step_data", {}).get("choice", 0)) == 1:
# if server only support choice 1, this is requiry some other logged devices to confirm and send verification, like this was you
resp_data3 = self._request(
endpoint=api_path, method=Method.POST, data={
"choice": 1, # TODO: enum phone/email verification. Which value represent which one?
"_csrftoken": self._session.cookies['csrftoken'],
"_uuid": self.state.uuid,
"bloks_versioning_id": self.state.bloks_version_id,
"post": 1
}
)
json_data3 = resp_data3.json()
print("auth data3\n{}".format(json_data3))
else:
_ = self._request(
endpoint=api_path, method=Method.POST, data={
"choice": 0, # TODO: enum phone/email verification. Which value represent which one?
"_csrftoken": self._session.cookies['csrftoken'],
"_uuid": self.state.uuid,
"bloks_versioning_id": self.state.bloks_version_id,
"post": 1
}
)
security_code = input("Verification needed. Type verification code here: ")
_ = self._request(
endpoint=api_path, method=Method.POST, data={
"_csrftoken": self._session.cookies['csrftoken'],
"_uuid": self.state.uuid,
"bloks_versioning_id": self.state.bloks_version_id,
"post": 1,
"security_code": security_code
}
)
return True
Errror msg:
DEBUG:instauto.api.actions.request:******************** START REQUEST ********************
METHOD: POST
URL: https://i.instagram.com/api/v1/challenge/***/cUTdlSn9gt/
DATA: {'choice': 1, '_csrftoken': '6uaoRTYLnNVCDcFq63wwVIRVX9NjyRpm', '_uuid': '3f3c14fa-705d-4c43-b4c4-43e731010530', 'bloks_versioning_id': '5da07fc1b20eb4c7d1b2e6146ee5f197072cbbd193d2d1eb3bb4e825d3c39e28', 'post': 1}
HEADERS: {'x-cm-bandwidth-kbps': '-1.000', 'x-cm-latency': '-1.000', 'x-ads-opt-out': '0', 'x-ig-app-locale': 'nl_NL', 'x-ig-app-startup-country': 'NL', 'x-ig-device-locale': 'nl_NL', 'x-ig-mapped-locale': 'nl_NL', 'x-ig-connection-speed': '1010kbps', 'x-ig-bandwidth-speed-kbps': '4850.178', 'x-ig-bandwidth-totalbytes-b': '0', 'x-ig-bandwidth-totaltime-ms': '0', 'x-ig-www-claim': '0', 'x-ig-device-id': '92fdded7-5422-45d1-ac51-e6de4a477d4e', 'x-ig-android-id': 'android-542245d1ac51e6de', 'x-ig-connection-type': 'WIFI', 'x-ig-capabilities': '3brTvw8=', 'x-ig-app-id': '567067343352427', 'user-agent': 'Instagram 148.0.0.33.121 Android (29/10; 560dpi; 1440x2891; samsung; SM-973F; SM-973F; exynos9820; nl_NL; 227298996)', 'accept-language': 'nl_NL, en_US', 'x-mid': 'X8N5CQABAAFgEFg6Gc1d-QnPGTGt', 'ig-u-rur': '', 'accept-encoding': 'gzip', 'x-fb-http-engine': 'Liger', 'authorization': 'Bearer IGT:2:', 'connection': 'close', 'x-pigeon-session-id': '77b813a2-0ec0-4cf1-ab89-17334b2e2062', 'x-pigeon-rawclienttime': '1606646029.425', 'x-bloks-version-id': '5da07fc1b20eb4c7d1b2e6146ee5f197072cbbd193d2d1eb3bb4e825d3c39e28', 'x-bloks-is-layout-rtl': 'False', 'host': 'i.instagram.com', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
RESPONSE: b'{"step_name": "verify_email", "step_data": {"security_code": "None", "resend_delay": 60, "contact_point": "l*******g@o*****.com", "form_type": "email"}, "flow_render_type": 3, "bloks_action": "com.instagram.challenge.navigation.take_challenge", "nonce_code": "cUTdlSn9gt", "user_id": ***, "challenge_context": "{\\"step_name\\": \\"verify_email\\", \\"nonce_code\\": \\"cUTdlSn9gt\\", \\"user_id\\": ***, \\"is_stateless\\": false}", "status": "ok"}'
******************** END REQUEST ********************
auth data3
{'step_name': 'verify_email', 'step_data': {'security_code': 'None', 'resend_delay': 60, 'contact_point': 'l*******g@o*****.com', 'form_type': 'email'}, 'flow_render_type': 3, 'bloks_action': 'com.instagram.challenge.navigation.take_challenge', 'nonce_code': 'cUTdlSn9gt', 'user_id': ***, 'challenge_context': '{"step_name": "verify_email", "nonce_code": "cUTdlSn9gt", "user_id": ***, "is_stateless": false}', 'status': 'ok'}
Verification needed. Type verification code here: 069174
DEBUG:urllib3.connectionpool:Resetting dropped connection: i.instagram.com
DEBUG:urllib3.connectionpool:https://i.instagram.com:443 "POST /api/v1/challenge/***/cUTdlSn9gt/ HTTP/1.1" 200 35
DEBUG:instauto.api.actions.request:Sent request to https://i.instagram.com/api/v1/challenge/***/cUTdlSn9gt/, method: POST with data:
{'_csrftoken': '6uaoRTYLnNVCDcFq63wwVIRVX9NjyRpm', '_uuid': '3f3c14fa-705d-4c43-b4c4-43e731010530', 'bloks_versioning_id': '5da07fc1b20eb4c7d1b2e6146ee5f197072cbbd193d2d1eb3bb4e825d3c39e28', 'post': 1, 'security_code': '069174'}
DEBUG:instauto.api.actions.request:******************** START REQUEST ********************
METHOD: POST
URL: https://i.instagram.com/api/v1/challenge/***/cUTdlSn9gt/
DATA: {'_csrftoken': '6uaoRTYLnNVCDcFq63wwVIRVX9NjyRpm', '_uuid': '3f3c14fa-705d-4c43-b4c4-43e731010530', 'bloks_versioning_id': '5da07fc1b20eb4c7d1b2e6146ee5f197072cbbd193d2d1eb3bb4e825d3c39e28', 'post': 1, 'security_code': '069174'}
HEADERS: {'x-cm-bandwidth-kbps': '-1.000', 'x-cm-latency': '-1.000', 'x-ads-opt-out': '0', 'x-ig-app-locale': 'nl_NL', 'x-ig-app-startup-country': 'NL', 'x-ig-device-locale': 'nl_NL', 'x-ig-mapped-locale': 'nl_NL', 'x-ig-connection-speed': '1486kbps', 'x-ig-bandwidth-speed-kbps': '3191.975', 'x-ig-bandwidth-totalbytes-b': '0', 'x-ig-bandwidth-totaltime-ms': '0', 'x-ig-www-claim': '0', 'x-ig-device-id': '92fdded7-5422-45d1-ac51-e6de4a477d4e', 'x-ig-android-id': 'android-542245d1ac51e6de', 'x-ig-connection-type': 'WIFI', 'x-ig-capabilities': '3brTvw8=', 'x-ig-app-id': '567067343352427', 'user-agent': 'Instagram 148.0.0.33.121 Android (29/10; 560dpi; 1440x2891; samsung; SM-973F; SM-973F; exynos9820; nl_NL; 227298996)', 'accept-language': 'nl_NL, en_US', 'x-mid': 'X8N5CQABAAFgEFg6Gc1d-QnPGTGt', 'ig-u-rur': '', 'accept-encoding': 'gzip', 'x-fb-http-engine': 'Liger', 'authorization': 'Bearer IGT:2:', 'connection': 'close', 'x-pigeon-session-id': '77b813a2-0ec0-4cf1-ab89-17334b2e2062', 'x-pigeon-rawclienttime': '1606646070.281', 'x-bloks-version-id': '5da07fc1b20eb4c7d1b2e6146ee5f197072cbbd193d2d1eb3bb4e825d3c39e28', 'x-bloks-is-layout-rtl': 'False', 'host': 'i.instagram.com', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}
RESPONSE: b'{"action": "close", "status": "ok"}'
******************** END REQUEST ********************
Traceback (most recent call last):
File "new_test_login.py", line 27, in <module>
client.login()
File "/usr/local/lib/python3.6/site-packages/instauto/api/actions/authentication.py", line 64, in login
resp = self._request('accounts/login/', Method.POST, data=data2, signed=True)
File "/usr/local/lib/python3.6/site-packages/instauto/api/actions/request.py", line 230, in _request
self._check_response_for_errors(resp)
File "/usr/local/lib/python3.6/site-packages/instauto/api/actions/request.py", line 266, in _check_response_for_errors
raise BadResponse("Received a non-200 response from Instagram")
instauto.api.exceptions.BadResponse: Received a non-200 response from Instagram
I do not have the time right now. caca72d here you can find working code for completing this type of challenge. If you really need it, you can add that in yourself. You just need to find a way to differentiate between phone/email and basic challenges.
Hello! I try to fix this, in some case server requery some other logged devices to confirm send the verification code to email(like to confirm this was me). In this case the choice equal to 1, like below:
b'{"step_name": "select_verify_method", "step_data": {"choice": "1", "fb_access_token": "None", "big_blue_token": "None", "google_oauth_token": "true", "vetted_device": "None", "email": "l*******g@o*****.com"}, "flow_render_type": 3, "bloks_action": "com.instagram.challenge.navigation.take_challenge", "nonce_code": "***", "user_id": ***, "challenge_context": "{\\"step_name\\": \\"select_verify_method\\", \\"nonce_code\\": \\"***\\", \\"user_id\\": ***, \\"is_stateless\\": false}", "status": "ok"}'
Modify the challenge code and the verification code has send to email, and enter the code to the running input interface and server response 200, but login still error:
class ChallengeMixin: ig_profile: IGProfile device_profile: DeviceProfile state: State _session: requests.Session _request: _request def _handle_challenge(self, resp: requests.Response) -> bool: resp_data = resp.json() print("auth data1\n{}".format(resp_data)) if resp_data['message'] not in ('challenge_required', 'checkpoint_required'): raise BadResponse("Challenge required, but no URL provided.") api_path = resp_data['challenge']['api_path'][1:] resp_data2 = self._request(endpoint=api_path, method=Method.GET, query={ "guid": self.state.uuid, "device_id": self.state.device_id } ) # TODO: Add support for different kinds of challenges. # Currently, only the verification pin challenge is supported, and other challenges, such as the # 'verify this was you', do not work. resp_json2 = resp_data2.json() if int(resp_json2.get("step_data", {}).get("choice", 0)) == 1: # if server only support choice 1, this is requiry some other logged devices to confirm and send verification, like this was you resp_data3 = self._request( endpoint=api_path, method=Method.POST, data={ "choice": 1, # TODO: enum phone/email verification. Which value represent which one? "_csrftoken": self._session.cookies['csrftoken'], "_uuid": self.state.uuid, "bloks_versioning_id": self.state.bloks_version_id, "post": 1 } ) json_data3 = resp_data3.json() print("auth data3\n{}".format(json_data3)) else: _ = self._request( endpoint=api_path, method=Method.POST, data={ "choice": 0, # TODO: enum phone/email verification. Which value represent which one? "_csrftoken": self._session.cookies['csrftoken'], "_uuid": self.state.uuid, "bloks_versioning_id": self.state.bloks_version_id, "post": 1 } ) security_code = input("Verification needed. Type verification code here: ") _ = self._request( endpoint=api_path, method=Method.POST, data={ "_csrftoken": self._session.cookies['csrftoken'], "_uuid": self.state.uuid, "bloks_versioning_id": self.state.bloks_version_id, "post": 1, "security_code": security_code } ) return True
Errror msg:
DEBUG:instauto.api.actions.request:******************** START REQUEST ******************** METHOD: POST URL: https://i.instagram.com/api/v1/challenge/***/cUTdlSn9gt/ DATA: {'choice': 1, '_csrftoken': '6uaoRTYLnNVCDcFq63wwVIRVX9NjyRpm', '_uuid': '3f3c14fa-705d-4c43-b4c4-43e731010530', 'bloks_versioning_id': '5da07fc1b20eb4c7d1b2e6146ee5f197072cbbd193d2d1eb3bb4e825d3c39e28', 'post': 1} HEADERS: {'x-cm-bandwidth-kbps': '-1.000', 'x-cm-latency': '-1.000', 'x-ads-opt-out': '0', 'x-ig-app-locale': 'nl_NL', 'x-ig-app-startup-country': 'NL', 'x-ig-device-locale': 'nl_NL', 'x-ig-mapped-locale': 'nl_NL', 'x-ig-connection-speed': '1010kbps', 'x-ig-bandwidth-speed-kbps': '4850.178', 'x-ig-bandwidth-totalbytes-b': '0', 'x-ig-bandwidth-totaltime-ms': '0', 'x-ig-www-claim': '0', 'x-ig-device-id': '92fdded7-5422-45d1-ac51-e6de4a477d4e', 'x-ig-android-id': 'android-542245d1ac51e6de', 'x-ig-connection-type': 'WIFI', 'x-ig-capabilities': '3brTvw8=', 'x-ig-app-id': '567067343352427', 'user-agent': 'Instagram 148.0.0.33.121 Android (29/10; 560dpi; 1440x2891; samsung; SM-973F; SM-973F; exynos9820; nl_NL; 227298996)', 'accept-language': 'nl_NL, en_US', 'x-mid': 'X8N5CQABAAFgEFg6Gc1d-QnPGTGt', 'ig-u-rur': '', 'accept-encoding': 'gzip', 'x-fb-http-engine': 'Liger', 'authorization': 'Bearer IGT:2:', 'connection': 'close', 'x-pigeon-session-id': '77b813a2-0ec0-4cf1-ab89-17334b2e2062', 'x-pigeon-rawclienttime': '1606646029.425', 'x-bloks-version-id': '5da07fc1b20eb4c7d1b2e6146ee5f197072cbbd193d2d1eb3bb4e825d3c39e28', 'x-bloks-is-layout-rtl': 'False', 'host': 'i.instagram.com', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} RESPONSE: b'{"step_name": "verify_email", "step_data": {"security_code": "None", "resend_delay": 60, "contact_point": "l*******g@o*****.com", "form_type": "email"}, "flow_render_type": 3, "bloks_action": "com.instagram.challenge.navigation.take_challenge", "nonce_code": "cUTdlSn9gt", "user_id": ***, "challenge_context": "{\\"step_name\\": \\"verify_email\\", \\"nonce_code\\": \\"cUTdlSn9gt\\", \\"user_id\\": ***, \\"is_stateless\\": false}", "status": "ok"}' ******************** END REQUEST ******************** auth data3 {'step_name': 'verify_email', 'step_data': {'security_code': 'None', 'resend_delay': 60, 'contact_point': 'l*******g@o*****.com', 'form_type': 'email'}, 'flow_render_type': 3, 'bloks_action': 'com.instagram.challenge.navigation.take_challenge', 'nonce_code': 'cUTdlSn9gt', 'user_id': ***, 'challenge_context': '{"step_name": "verify_email", "nonce_code": "cUTdlSn9gt", "user_id": ***, "is_stateless": false}', 'status': 'ok'} Verification needed. Type verification code here: 069174 DEBUG:urllib3.connectionpool:Resetting dropped connection: i.instagram.com DEBUG:urllib3.connectionpool:https://i.instagram.com:443 "POST /api/v1/challenge/***/cUTdlSn9gt/ HTTP/1.1" 200 35 DEBUG:instauto.api.actions.request:Sent request to https://i.instagram.com/api/v1/challenge/***/cUTdlSn9gt/, method: POST with data: {'_csrftoken': '6uaoRTYLnNVCDcFq63wwVIRVX9NjyRpm', '_uuid': '3f3c14fa-705d-4c43-b4c4-43e731010530', 'bloks_versioning_id': '5da07fc1b20eb4c7d1b2e6146ee5f197072cbbd193d2d1eb3bb4e825d3c39e28', 'post': 1, 'security_code': '069174'} DEBUG:instauto.api.actions.request:******************** START REQUEST ******************** METHOD: POST URL: https://i.instagram.com/api/v1/challenge/***/cUTdlSn9gt/ DATA: {'_csrftoken': '6uaoRTYLnNVCDcFq63wwVIRVX9NjyRpm', '_uuid': '3f3c14fa-705d-4c43-b4c4-43e731010530', 'bloks_versioning_id': '5da07fc1b20eb4c7d1b2e6146ee5f197072cbbd193d2d1eb3bb4e825d3c39e28', 'post': 1, 'security_code': '069174'} HEADERS: {'x-cm-bandwidth-kbps': '-1.000', 'x-cm-latency': '-1.000', 'x-ads-opt-out': '0', 'x-ig-app-locale': 'nl_NL', 'x-ig-app-startup-country': 'NL', 'x-ig-device-locale': 'nl_NL', 'x-ig-mapped-locale': 'nl_NL', 'x-ig-connection-speed': '1486kbps', 'x-ig-bandwidth-speed-kbps': '3191.975', 'x-ig-bandwidth-totalbytes-b': '0', 'x-ig-bandwidth-totaltime-ms': '0', 'x-ig-www-claim': '0', 'x-ig-device-id': '92fdded7-5422-45d1-ac51-e6de4a477d4e', 'x-ig-android-id': 'android-542245d1ac51e6de', 'x-ig-connection-type': 'WIFI', 'x-ig-capabilities': '3brTvw8=', 'x-ig-app-id': '567067343352427', 'user-agent': 'Instagram 148.0.0.33.121 Android (29/10; 560dpi; 1440x2891; samsung; SM-973F; SM-973F; exynos9820; nl_NL; 227298996)', 'accept-language': 'nl_NL, en_US', 'x-mid': 'X8N5CQABAAFgEFg6Gc1d-QnPGTGt', 'ig-u-rur': '', 'accept-encoding': 'gzip', 'x-fb-http-engine': 'Liger', 'authorization': 'Bearer IGT:2:', 'connection': 'close', 'x-pigeon-session-id': '77b813a2-0ec0-4cf1-ab89-17334b2e2062', 'x-pigeon-rawclienttime': '1606646070.281', 'x-bloks-version-id': '5da07fc1b20eb4c7d1b2e6146ee5f197072cbbd193d2d1eb3bb4e825d3c39e28', 'x-bloks-is-layout-rtl': 'False', 'host': 'i.instagram.com', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} RESPONSE: b'{"action": "close", "status": "ok"}' ******************** END REQUEST ******************** Traceback (most recent call last): File "new_test_login.py", line 27, in <module> client.login() File "/usr/local/lib/python3.6/site-packages/instauto/api/actions/authentication.py", line 64, in login resp = self._request('accounts/login/', Method.POST, data=data2, signed=True) File "/usr/local/lib/python3.6/site-packages/instauto/api/actions/request.py", line 230, in _request self._check_response_for_errors(resp) File "/usr/local/lib/python3.6/site-packages/instauto/api/actions/request.py", line 266, in _check_response_for_errors raise BadResponse("Received a non-200 response from Instagram") instauto.api.exceptions.BadResponse: Received a non-200 response from Instagram
Sorry, actually error is this, save cookie with some none json serializable data.
{'LoggedInAccountData': mappingproxy({'__module__': 'instauto.api.structs', '__doc__': 'Structure that stores information about the Instagram account', '__init__': <function LoggedInAccountData.__init__ at 0x7ffb7d0646a8>, '__repr__': <function LoggedInAccountData.__repr__ at 0x7ffb7d064730>, '__dict__': <attribute '__dict__' of 'LoggedInAccountData' objects>, '__weakref__': <attribute '__weakref__' of 'LoggedInAccountData' objects>})}
ERROR:instauto.api.client:Object of type 'mappingproxy' is not JSON serializable
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/instauto/api/client.py", line 157, in save_to_disk
}, f)
File "/usr/lib64/python3.6/json/__init__.py", line 179, in dump
for chunk in iterable:
File "/usr/lib64/python3.6/json/encoder.py", line 430, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/usr/lib64/python3.6/json/encoder.py", line 404, in _iterencode_dict
yield from chunks
File "/usr/lib64/python3.6/json/encoder.py", line 437, in _iterencode
o = _default(o)
File "/usr/lib64/python3.6/json/encoder.py", line 180, in default
o.__class__.__name__)
TypeError: Object of type 'mappingproxy' is not JSON serializable
The reason of json error is in /instauto/api/structs.py
, line 200:
self.logged_in_account_data = LoggedInAccountData
should replace to
self.logged_in_account_data = LoggedInAccountData()
@stanvanrooy Can you take a look at returnWOW 's suggest.please?
@cheersgocheersgo could you check if it's working
yeah,now workting quite well,thanks a lot.boy,You are one of the best technology I have ever met
You should thank @returnWOW for this one :)
Describe the bug get a non-200 response from Instagram when handle challenge
Sorry for my bad English.