tylerolson / reddit2instagrambot

A bot that uploads top Reddit posts to Instagram.
https://instagram.com/rocketleague.bot
44 stars 9 forks source link

AttributeError: 'InstagramAPI' object has no attribute 'token' #9

Closed NathanYearout closed 5 years ago

NathanYearout commented 5 years ago

After legit months of looking for a reddit to instagram bot I finally found this one and it's amazing. I only have one issue so far that started happening today, now when I run the bot I'm getting a error message along the lines of this: Request return 400 error! {'message': 'Sorry, there was a problem with your request.', 'status': 'fail', 'error_type': 'sentry_block'} Traceback (most recent call last): File "main.py", line 37, in <module> main(args) File "main.py", line 17, in main downloadAndUpload() File "main.py", line 25, in downloadAndUpload instagram.upload_subs(found_subs) File "/home/ubuntu/bot/reddit2instagram/instagram.py", line 29, in upload_subs instagram_api.uploadPhoto(os.path.join(BASE_DIR, "media", sub["id"] + "_resized" + sub["format"]), caption=sub_caption) File "/home/ubuntu/.local/lib/python3.6/site-packages/InstagramAPI/InstagramAPI.py", line 146, in uploadPhoto '_csrftoken': self.token, AttributeError: 'InstagramAPI' object has no attribute 'token' I don't know if instagram was updated rendering the private API useless or what. I also don't have 2auth active. Thank you.

NathanYearout commented 5 years ago

Also I don't think I was blocked/banned by instagram as I can still post and browse instagram fine from my home network.

tylerolson commented 5 years ago

So from my experience "AttributeError: 'InstagramAPI' object has no attribute 'token' " means that the API failed to login and cannot properly initialize. 2 things: how old is your account, and how often are you running the program?

NathanYearout commented 5 years ago

The account is brand new, I made it a couple of days ago. As far as how much I'm posting, I changed main.py's schedule so it would check Reddit and post every 5 minutes, but after it broke I installed the script on a virtual machine and changed it to check and post every 10 minutes. I might just be posting to frequently.

tylerolson commented 5 years ago

Yeah I had a bunch of problems with my account until it was about a week old. I think Instagram has build in spam features that limit brand new accounts.

NathanYearout commented 5 years ago

That makes sense. I hate Instagram with a passion to be honest. 😂 Thank you for the replies though. 👍

tylerolson commented 5 years ago

Is it working now?

NathanYearout commented 5 years ago

It's working but after a couple days I start getting the same error. It works as soon as I create a new Ubuntu server though so I think Instagram "bans" the bot after a week. Which is weird.