main.py 429 B

1234567891011121314151617181920
  1. import schedule
  2. import time
  3. import requests
  4. def job():
  5. global counter
  6. now = int(time.time())
  7. print("Running requests - timestamp: %s (%s)" %
  8. (now, time.strftime("%d-%m-%Y %H:%M:%S", time.gmtime(now))))
  9. r = requests.get('https://devt.de')
  10. res_time = r.elapsed
  11. print (" https://devt.de -> ", res_time)
  12. schedule.every(2).seconds.do(job)
  13. while True:
  14. schedule.run_pending()
  15. time.sleep(1)