ohld / igbot

🐙 Free scripts, bots and Python API wrapper. Get free followers with our auto like, auto follow and other scripts!
https://hikerapi.com/p/N2P6iqiM
Apache License 2.0
4.69k stars 1.47k forks source link

'Bot' object has no attribute 'send_request' #813

Closed iamdublex closed 5 years ago

iamdublex commented 5 years ago

Please follow the guide below


Before submitting an issue, make sure you have:

Purpose of your issue?


The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.


For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Paste the output of python -V here: Python 3.7.2

Code:

# Example code that will produce the error reported
#Check the description.
from instabot import Bot
import os
import sys
from time import sleep
import json
import pprint

from instabot import Bot
def _solve_checkpoint_challenge(_bot):
   # sleep(3)
    challenge_url = _bot.last_json['challenge']['api_path'][1:]
    try:
        _bot.send_request(
            challenge_url, None, login=True, with_signature=False)
    except Exception as e:
        _bot.logger.error(e)
        return False
bot = Bot()
try:
    bot.login()
    bot.follow_users("instagram")
except:
    if bot.last_json.get('error_type', '') == "checkpoint_challenge_required":
        var = _solve_checkpoint_challenge(bot)
else:
    print("Logged in without error.")

Error/Debug Log:

2019-02-10 00:29:05,030 Instabot Started
2019-02-10 00:29:21,773 Request returns 400 error!
2019-02-10 00:29:21,789 Instagram's error message: challenge_required
2019-02-10 00:29:21,789 Error type: checkpoint_challenge_required
2019-02-10 00:29:21,789 Username or password is incorrect.
2019-02-10 00:29:21,789 Going to follow 9 users.
2019-02-10 00:29:21,804 Not logged in!
2019-02-10 00:29:21,804 'Bot' object has no attribute 'send_request'

Describe your issue

The except: won't trigger on only checkpoint_challenge_required, so the bot.follow_users() is necessary. If you're wondering how exactly the code surpasses the challenge, I didn't include the full code, because I'm only interested in why the bot.send_request is not defined. Don't bother about the unnecessary imports, they are essential for the rest of the code.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

ohld commented 5 years ago

bot.api.send_request

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.