Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reconnect to an API?
#1
Hello everyone, my Python program connects to an API, is there any way to make it try and "auto reconnect" every 1 min to the said API if it gets disconnected?

My connection code is on a single thread.. so mechanically, I would need a way to just:

1. detect a disconnect, and
2. IF disconnect found, do a while loop on the thread.start()
3. untill connection restored?

This should be an interesting discussion and hopefully I learn alot from it but I am still pretty new, so simple explanations and code examples are the best Pray
Reply
#2
So after some head aching searching, it seems the easiest way to do this is to have a totally separate script monitoring some type of connection, if the connection goes out, close the original script and re-run the original script after connection is restablished?
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020