old_contents: #!/usr/bin/python
  # Authenticates against a LAN using HTTP Basic Auth
  
  import sys
  
  if len(sys.argv) != 4:
      print ("Invalid arguments")
      print ("Proper syntax is: " + sys.argv[0] + " [url] [username] [password]")
      sys.exit(1)
  
  import requests
  import requests.exceptions
  
  auth_target = sys.argv[1]
  username = sys.argv[2]
  password = sys.argv[3]
  
  if "http" not in auth_target:
      auth_target = "http://" + auth_target
  
  print ("Checking connection to: " + auth_target)
  
  try:
      auth_check = requests.get(auth_target)
  except requests.exceptions.ConnectionError as e:
      print (e)
      sys.exit(2)
  except requests.exceptions.Timeout as e:
      print (e)
      sys.exit(3)
  except Exception as e:
      print (e)
      sys.exit(98)
  
  check_status = auth_check.status_code
  print ("Response status code is: " + str(check_status))
  
  if check_status == 200:
      print ("You are already authenticated")
      sys.exit(0)
  
  print ("Authenticating...")
  
  try:
      do_auth = requests.get(auth_target, auth=(username, password))
  except requests.exceptions.ConnectionError as e:
      print (e)
      sys.exit(4)
  except requests.exceptions.Timeout as e:
      print (e)
      sys.exit(5)
  except Exception as e:
      print (e)
      sys.exit(99)
  
  auth_status = do_auth.status_code
  if auth_status == 200:
      print ("Authentication successful")
  else:
      print ("Authentication failed with response code: " + str(auth_status))
  
  
new_contents: #!/usr/bin/python
  # Authenticates against a LAN using HTTP Basic Auth
  
  import sys
  
  if len(sys.argv) != 4:
      print ("Invalid arguments")
      print ("Proper syntax is: " + sys.argv[0] + " [url] [username] [password]")
      sys.exit(1)
  
  import requests
  import requests.exceptions
  
  auth_target = sys.argv[1]
  username = sys.argv[2]
  password = sys.argv[3]
  
  if "http" not in auth_target:
      auth_target = "http://" + auth_target
  
  print ("Checking connection to: " + auth_target)
  
  try:
      auth_check = requests.get(auth_target, verify=False)
  except requests.exceptions.ConnectionError as e:
      print (e)
      sys.exit(2)
  except requests.exceptions.Timeout as e:
      print (e)
      sys.exit(3)
  except Exception as e:
      print (e)
      sys.exit(98)
  
  check_status = auth_check.status_code
  print ("Response status code is: " + str(check_status))
  
  if check_status == 200:
      print ("You are already authenticated")
      sys.exit(0)
  
  print ("Authenticating...")
  
  try:
      do_auth = requests.get(auth_target, auth=(username, password), verify=False)
  except requests.exceptions.ConnectionError as e:
      print (e)
      sys.exit(4)
  except requests.exceptions.Timeout as e:
      print (e)
      sys.exit(5)
  except Exception as e:
      print (e)
      sys.exit(99)
  
  auth_status = do_auth.status_code
  if auth_status == 200:
      print ("Authentication successful")
  else:
      print ("Authentication failed with response code: " + str(auth_status))
  
subject: Disable SSL check which is impossible if not authenticated to the LAN