You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
428 B

  1. import requests
  2. URL = "PING_URL"
  3. def do_work():
  4. # Do your number crunching, backup dumping, newsletter sending work here.
  5. # Return a truthy value on success.
  6. # Return a falsy value or throw an exception on failure.
  7. return True
  8. success = False
  9. try:
  10. success = do_work()
  11. finally:
  12. # On success, requests PING_URL
  13. # On failure, requests PING_URL/fail
  14. requests.get(URL if success else URL + "/fail")