Exemplo n.º 1
0
def checkAuth(host, iUsername, iPassword):
  client = tinydav.HTTPClient(host)
  client.setbasicauth(iUsername, iPassword)
  try:
    print client.head('/test')
  except HTTPUserError as e:
    #logging
    print e
    logging.debug(e)
    return False
  return True
Exemplo n.º 2
0
def loadAuth(iPath):
  username, password = '', ''
  try:
    with open(iPath) as f:
      content = yaml.load(f)
      username = base64.decodestring(content[base64.encodestring('username')])
      password = base64.decodestring(content[base64.encodestring('password')])
  except Exception as e:
    # logging e
    logging.debug(e)
  return username, password