I have an issue with the script that I run to share posts on Instagram. The script works fine on my machine but when I ran it on a VM with OS ubuntu 16.04-LTS, it throws an error with too many requests and the error is as follows:
I think the problem is with the network, but I don’t know how to fix it.
from instabot import Bot
bot = Bot()
bot.login(username = username, password = password)
bot.upload_photo('img', caption='caption')
Please let me know if you have any ideas on how I can fix this.
Thank you for your time.
2
Answers
I found an answer that can help someone in the future:
After some research, I found that you should run
cd /home/env/lib/python3.8/site-packages/instabot/api
and it should work for you. If not, find your own path using these two commandspip list -v
andpip show
. Hope this helps!Edit the file
api.py
then comment from lines 559 to 585 but try not to make a lot of requests to not be blocked.It means you are sending too many request to the site. https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
I would suggest using a retry-strategy to try again after a given amount of time.
https://urllib3.readthedocs.io/en/stable/reference/urllib3.util.html