Skip to content

Instantly share code, notes, and snippets.

@Ethic41
Created October 12, 2023 19:04
Show Gist options
  • Select an option

  • Save Ethic41/757d9b5cb2366d7752ff4965671c818a to your computer and use it in GitHub Desktop.

Select an option

Save Ethic41/757d9b5cb2366d7752ff4965671c818a to your computer and use it in GitHub Desktop.
#!/bin/env python3
#Author: Dahir Muhammad Dahir
#Date: 05th-02-2022
from time import sleep
import requests
def main():
keep_alive()
def keep_alive():
url = input("enter url to keep alive:\n")
time_interval = input("[Optional] enter time interval in seconds, default 5mins (300 seconds):\n")
time_interval = time_interval if time_interval else 300
print(f"keeping {url} alive at {time_interval} seconds interval...")
while True:
with requests.Session() as s:
s.get(url)
sleep(int(time_interval))
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment