Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] running my script logs me out of my account on my other devices, logging back in crashes script #1314

Open
dylanwdw opened this issue May 2, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@dylanwdw
Copy link

dylanwdw commented May 2, 2023

I wrote a python script to periodically upload media to my Instagram page. When I run the script, I get a message on my phone saying I've been logged out of instagram. If i dont log back in, the script works perfectly fine. However if I try to log in again, the script will crash upon the next media upload.

"instagrapi.exceptions.PhotoNotUpload: {"message": "login_required", "status": "faill"}

steps to reproduce:
I copied my login function from the "best practices" page.

@dylanwdw dylanwdw added the bug Something isn't working label May 2, 2023
@noqcks
Copy link
Contributor

noqcks commented May 2, 2023

Some questions:

  • Are you adding delays between requests? cl.delay_range = [1, 3]
  • Are you using a stored session object instead of attempting to login each time?
  • Are you connecting from an IP address that's close to the normal user? Not from a public cloud like AWS. Instagram doesn't like the AWS IP address range.
  • How many photos uploads are you doing per day?
  • Are you doing media uploads at the same time every day?
  • Have you recently tried to login using the user/password many times in the last couple days? Sometimes instagram will do this logout functionality and you just need to wait a couple days before you can try again.

@claell
Copy link
Contributor

claell commented May 12, 2023

@dylanwdw sounds like Instagram saw some suspicious activities.

I also have this problem recently (logout or other verification challenge needed after minimal actions). Not sure what causes this, as my scripts didn't change that much. Haven't been running them for some time (some months), though. So not sure whether this is just Instagram detecting things or whether it's related to updating the Instagrapi package (and thus a valid issue; in the past, it usually wasn't the package's fault, exception: #1286).

@noqcks

  • I didn't add the delays before (in the past it also worked fine) but recently did because of the problems. That doesn't help, though, as of now.
  • Yes, I use the session object, but need to start with clean sessions recently, as the old one stops working after one time.
  • IP is either probably identical to the normal account usage or in the same city.
  • Using it mostly for interactions like following, messaging etc.
  • I might have tried several logins in the past due to problems, maybe I just need to wait.

@noqcks
Copy link
Contributor

noqcks commented May 12, 2023

@claell try and limit interactions until you can complete one run of your bot without instagram terminating the session.

Instagram thinks you're a bot and is terminating the session.

@claell
Copy link
Contributor

claell commented May 12, 2023

I can do that, but then the session will apparently get terminated some time after? At least, I experienced that the client was not working for further things when I tried again. Maybe that is one action too much already, then? It's just login, follow and send two messages; done. Maybe already too much at the moment.

Also, I experienced that some time after (like 20 minutes), Instagram asks me to do a challenge like phone verification in the app (bot didn't run there).

Might be true that the account is just very limited right now, and I just need to wait. It seems that the limits currently are much tighter than anything I have experienced before.

@Allaux
Copy link

Allaux commented May 20, 2023

Hello,
I am logged out after 10 minutes and 20 requests to direct message, how and how i can sole this ?
When i use other code its work and not logged me out.
Other code he work great : https://github.com/Willy-JL/InstaDownloader , can you check for update your code for not rate limted like this code ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants