AttributeError: 'NoneType' object has no attribute 'get'` with invalid literal for int() with base 10

275 Views Asked by At

While creating an Instagram bot I ran into these problems within the source code, I think. As I understood the program stops while trying to read the follower number of my account which provides the get error. The message from the power sell is as follow, some values are changed for privacy reason


`OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2023-08-20 02:24:34] [username]  Session started!
oooooooooooooooooooooooooooooooooooooooooooooooooooooo
INFO [2023-08-20 02:24:42] [username]  - Cookie file for user 'ethiopiangossip' loaded...
.....................................................................
INFO [2023-08-20 02:25:07] [username]  Logged in successfully!
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
INFO [2023-08-20 02:25:07] [username]  Saving account progress...
WARNING [2023-08-20 02:25:11] [username]  Unable to save account progress, skipping data update
        b"invalid literal for int() with base 10: '443\\nfollowers'"
Traceback (most recent call last):
  File "C:\Users\user\Documents\Python\Bots\Instagram.py", line 6, in <module>
    session.login()
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\instapy\instapy.py", line 475, in login
    self.followed_by = int(float(log_follower_num(self.browser, self.username, self.logfolder)))
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\instapy\print_log_writer.py", line 21, in log_follower_num
    followed_by = getUserData("graphql.user.edge_followed_by.count", browser)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\instapy\util.py", line 501, in getUserData
    get_key = shared_data.get("entry_data").get("ProfilePage")
              ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'`

The source code is as follows, some values are changed for privacy reasons

from instapy import InstaPy

# Enter username and password
session = InstaPy(username="username", password="password",
                  headless_browser=False,  want_check_browser=False)
session.login()

session.set_relationship_bounds(enabled=True, max_followers=200)

session.set_do_follow(True, percentage=100)

session.set_user_interact(amount=3, randomize=True, percentage=100)

session.like_by_locations(['zz', 'zzz', amount=20)

session.end()

lines mentioned in powershell

I don't know how to fix them so any help is appreciated.

0

There are 0 best solutions below