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

Connection broken errors #93

Closed mafa89 closed 7 years ago

mafa89 commented 7 years ago

Hello, Has anyone experienced errors like "(104) Connection reset by peer", or similar? It seems to happen sometimes, and it stops the bot.

Would it make sense to implement requests in "try, exception" modules, and perform a new login if the connection is interrupted?

Thank you

ohld commented 7 years ago

Can you describe how to get this error? It will help to find and fix it

mafa89 commented 7 years ago

Sure, it appears the following text:

File "/home/maf/Desktop/BOT/../instabot/api/api.py", line 340, in getUserFollowers return self.SendRequest('friendships/' + str(usernameId) + '/followers/?rank_token=' + self.rank_token + '&max_id=' + str(maxid)) File "/home/maf/Desktop/BOT/../instabot/api/api.py", line 109, in SendRequest response = self.session.get(config.API_URL + endpoint) # , verify=False File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 501, in get return self.request('GET', url, kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 641, in send r.content File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 797, in content self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes() File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 722, in generate raise ChunkedEncodingError(e) requests.exceptions.ChunkedEncodingError: ("Connection broken: error(104, 'Connection reset by peer')", error(104, 'Connection reset by peer'))

penarubah commented 7 years ago

yes, i have seen this, it because the connection are not stable. after resetting my modem, and restart the script, it gone. @ohld maybe we must implement connection lost handling. so, when connection lost, the script pause and tell error, therefore resume it.

mafa89 commented 7 years ago

Yes, this is what I was thinking about. For me it is enough to restart the "run" script, without actually restarting the modem. It would be good to add an auto-reconnect option... I also have to say that it happens much more often if likes are enabled, if I do only follow/unfollow it rarely occurs.