Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

[BUG] using "ask_for_code=True" returns error #1299

Open
SiavashJafari opened this issue Feb 19, 2020 · 1 comment
Open

[BUG] using "ask_for_code=True" returns error #1299

SiavashJafari opened this issue Feb 19, 2020 · 1 comment
Labels

Comments

@SiavashJafari
Copy link

Example file

like_users.py

Describe the bug

while using "ask_for_code=True"
after inputing the sent code (from instagram) to email, below (provided) error shows up!

Log

2020-02-18 18:02:31,500 - INFO - PRE-LOGIN FLOW!...
2020-02-18 18:02:32,732 - DEBUG - POST to endpoint: accounts/read_msisdn_header/ returned response: <Response [200]>
2020-02-18 18:02:34,924 - DEBUG - POST to endpoint: launcher/sync/ returned response: <Response [200]>
2020-02-18 18:02:36,097 - DEBUG - POST to endpoint: qe/sync/ returned response: <Response [200]>
2020-02-18 18:02:38,247 - DEBUG - POST to endpoint: attribution/log_attribution/ returned response: <Response [200]>
2020-02-18 18:02:39,555 - DEBUG - POST to endpoint: accounts/contact_point_prefill/ returned response: <Response [200]>
2020-02-18 18:02:43,306 - DEBUG - POST to endpoint: accounts/login/ returned response: <Response [400]>
2020-02-18 18:02:43,307 - DEBUG - Responsecode indicates error; response content: {"message": "challenge_required", "challenge": {"url": "https://i.instagram.com/challenge/17911302241/6aT0cwNQEu/", "api_path": "/challenge/17911302241/6aT0cwNQEu/", "hide_webview_header": true, "lock": true, "logout": false, "native_flow": true}, "status": "fail", "error_type": "checkpoint_challenge_required"}
2020-02-18 18:02:43,307 - ERROR - Request returns 400 error!
2020-02-18 18:02:43,307 - INFO - Instagram's error message: challenge_required
2020-02-18 18:02:43,307 - INFO - Error type: checkpoint_challenge_required
2020-02-18 18:02:43,307 - INFO - Checkpoint challenge required...
2020-02-18 18:02:46,150 - DEBUG - GET to endpoint: challenge/17911302241/6aT0cwNQEu/ returned response: <Response [200]>
Checkpoint challenge received
0 - Phone
1 - Email
Insert choice: 1
2020-02-18 18:03:04,786 - DEBUG - POST to endpoint: challenge/17911302241/6aT0cwNQEu/ returned response: <Response [200]>
A code has been sent to the method selected, please check.
Insert code: 530286
Traceback (most recent call last):
File "./like_users.py", line 23, in
bot.login(username=args.u, password=args.p, proxy=args.proxy, ask_for_code=True)
File "/home/user/Downloads/instabot/instabot/bot/bot.py", line 443, in login
if self.api.login(**args) is False:
File "/home/user/Downloads/instabot/instabot/api/api.py", line 273, in login
solved = self.solve_challenge()
File "/home/user/Downloads/instabot/instabot/api/api.py", line 369, in solve_challenge
code = input("Insert code: ").replace(" ", "")
AttributeError: 'int' object has no attribute 'replace'

To Reproduce

(EXAMPLE:) Steps to reproduce the behavior:

python ./like_users.py users [username]

Expected behavior

to accepts the confirmation code and login

Additional context

code:
"""
instabot example
Workflow:
Like last medias by users.
"""
import argparse
import os
import sys

sys.path.append(os.path.join(sys.path[0], "../"))
from instabot import Bot # noqa: E402

parser = argparse.ArgumentParser(add_help=True)
parser.add_argument("-u", type=str, help="username")
parser.add_argument("-p", type=str, help="password")
parser.add_argument("-l", type=int, help="limit")
parser.add_argument("-proxy", type=str, help="proxy")
parser.add_argument("users", type=str, nargs="+", help="users")
args = parser.parse_args()

bot = Bot()
bot.login(username=args.u, password=args.p, proxy=args.proxy, ask_for_code=True)

for username in args.users:
bot.like_user(username, amount=args.l, filtration=False)

Version

Python version (python -v): Python 2.7.17
OS: Linux Ubuntu 18

@duplicate-issues
Copy link

Hey @SiavashJafari,

We did a quick check and this issue looks very darn similar to

This could be a coincidence, but if any of these issues solves your problem then I did a good job 😄

If not, the maintainers will get to this issue shortly.

Cheers,
Your Friendly Neighborhood ProBot

@bruvv bruvv added the bug label Feb 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants