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

Cookie AssertionError when loading cookie with a username with uppercase #1028

Closed Rayanox closed 5 years ago

Rayanox 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:

Code:

"""
    instabot example
    Workflow:
        Follow user's followers by username.
"""

import argparse
import os
import sys
import json

sys.path.append(os.path.join(sys.path[0], '../'))
from instabot import Bot

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('-proxy', type=str, help="proxy")
parser.add_argument('-usernameTarget', type=str, help='usernameTarget')
args = parser.parse_args()

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

result = bot.convert_to_user_id("Rayanox")
print("result = " + result);

exit(0)

Error/Debug Log:

PS C:\Users\rbenhmidane\Documents\Repositories\Instagram-follower-booster\Scripts> python .\test.py -u "Rayanox92" -p "*****" -usernameTarget "Rayanox92"
2019-09-03 11:37:44,748 - INFO - Instabot Started
cookie_username = rayanox92
self.username = Rayanox92
Traceback (most recent call last):
  File ".\test.py", line 28, in <module>
    proxy=args.proxy, use_cookie=True)
  File "C:\Users\rbenhmidane\AppData\Local\Programs\Python\Python37\lib\site-packages\instabot\bot\bot.py", line 369, in login
    if self.api.login(**args) is False:
  File "C:\Users\rbenhmidane\AppData\Local\Programs\Python\Python37\lib\site-packages\instabot\api\api.py", line 198, in login
    self.load_uuid_and_cookie(load_cookie=use_cookie, load_uuid=use_uuid)
  File "C:\Users\rbenhmidane\AppData\Local\Programs\Python\Python37\lib\site-packages\instabot\api\api.py", line 159, in load_uuid_and_cookie
    return load_uuid_and_cookie(self, load_uuid=load_uuid, load_cookie=load_cookie)
  File "C:\Users\rbenhmidane\AppData\Local\Programs\Python\Python37\lib\site-packages\instabot\api\api_login.py", line 202, in load_uuid_and_cookie
    assert cookie_username == self.username
AssertionError

I added two custom logs to show the value of 'cookie_username' and 'self.username' just before the assertion.


Describe your issue

When using an account name that contains an "uppercase", the cookie loading fails and throws an assertion error (api_login.py:200). I have just investigate on this issue, using the last version of the scripts, and I found that the username cookie loaded is stored in lowercase, and when checking that it equals my username it fails because there is an uppercase in my username. A simple fix is to force the username to be lower just for the comparison, it's not the best solution but it's still better than the existing code.

MertisWee commented 4 years ago

sooo, what do i need to do ?

Rayanox commented 4 years ago

Nothing. It has already been fixed -> https://github.com/instagrambot/instabot/pull/1029

Abdulsamipy commented 4 years ago

Nothing. It has already been fixed -> #1029

pardon me .. can you tell me what to do to fix the issue?