daily pastebin goal
16%
SHARE
TWEET

tmp

a guest Apr 17th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def check_update_via_link():
  2.     now = time.ctime()
  3.     url = "http://xxx"
  4.     try:
  5.         r = requests.get(url=url, verify=False, timeout=3)
  6.         if r.status_code==200:
  7.             print 'Update user OK at ' + now
  8.             #sys.exit(0)
  9.         else :
  10.             print 'Update user FAILED at ' + now
  11.             sys.exit(2)
  12.     except requests.exceptions.HTTPError, err:
  13.         return 'Update user FAILED at ' + now + str(err)
  14.         sys.exit(1)
  15.     except requests.exceptions.RequestException as err:
  16.         print 'Update user FAILED OOps: Something Else: ' + str(err)
  17.         sys.exit(1)
  18.     except requests.exceptions.ConnectionError as errc:
  19.         print 'Update user FAILED Error Connecting: ' + str(errc)
  20.         sys.exit(1)
  21.     except requests.exceptions.Timeout:
  22.         print 'Update user FAILED Timeout Error: '  + str(errt)
  23.         sys.exit(1)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top